Just picture it: the speaker and his lady-friend are at the strand (i.e., the beach). He writes her name in the sand, but a wave comes and washes it away. He writes it again, but alas, a wave washes it away again (no big surprise there, really).
The woman says that it's silly for the speaker to be writing her name in the sand to begin with; she's going to die one day and disappear from the earth, just as her name has disappeared.
Then the speaker works his magic. He tells his sweetie that he'll immortalize her by writing about her in his poems. Their names will live forever in his poetry, and their love will live on forever and ever. Aw, how sweet.