Then ... As a Yellow cab drops Mrs Kraft off at the remote address given her by Marty, amongst a lonely stretch of sand dunes, viewers can be excused if they find themselves gripping their seats in trepidation.
... and Now, but where was this filmed? It clearly is meant to be somewhere in the Outer Sunset, a district that in the early to mid 20th century saw its vast area of sand dunes inexorably replaced with tract housing. While there are insufficient clues to work out the exact spot, the location below, at the corner of Santiago Street and the Great Highway (map) is typical of where it could have been. The landscaped dunes on the right separate this frontage road from the Great Highway and the ocean.
... but wait a minute. It turns out this scene was not filmed in San Francisco at all. The moviemakers chose another location on the California coast with a sand dune complex that rivaled San Francisco's but which lagged the development of the Sunset district. CitySleuth came across a reference to a Hollywood Reporter article revealing that one of the movie's location shoots, obviously this one, was filmed at the beach in El Segundo. By now, most of that city's dunes have gone too but there's still a significant surviving strip sandwiched between the beach and Los Angeles' International airport (map).
Then ... Marty leads the dear old lady, she finally realizing she has gotten herself into dire straits, into the dunes and pulls a knife, intent on carrying out Sam's order to do her in. But, surprise (!!), Sam himself suddenly appears ...
... and Now, here's a photo of very similar sand dunes recently taken at El Segundo beach.
Mrs Kraft escapes as Sam throws Marty to the ground. Paranoid as ever he had jumped to the wrong conclusion after he saw him leaving Helen's room (after an innocent conversation as it happens). Marty's protestations fail to stop the cold-blooded killer from driving the knife home.
When the police show up the next day at their home with questions (Marty had been staying there as a guest) Sam tells them he had been playing cards all evening with Helen. Startled, and despite realizing that his lie could only mean that he was the killer, she nevertheless supports his alibi.