How can you make sure you remember the melody for any lyrics you write? I am not even sure if it's possible, because I don't know any notation system for lyrics that allows you to write down the melody. How is this done and how can you write it using the alphabet and various symbols?
If you want a notation system, then the common way to write lyrics with melody is to write the melody in standard notation and then place the lyrics below the corresponding notes. This is what you will find in most songbooks.
If you just need to save the idea before you forget it, then recording an audio clip is probably your best bet.
You can always record yourself. I'm guessing that you can sing the melody (or play it in some instrument or other), so take a recorder and record it.
If you don't want to or cannot afford to buy a proper recorder, since you just want something to use as a reminder for your melody, so you can simply use a smartphone. Modern smartphones have microphones that are pretty decent for something like that. Also, modern computers usually have some kind of software that you can use to record simple stuff like that (or you can easily find a free one).
I don't know any notation system for lyrics that allows you to write down the melody
This is kind of ambiguous. Are you implying that you do know some kind of notation? Because if you do, you can write the melody using notes, and the lyrics below.
Nothing beats a recorder for that matter.
Also when improvising/composing, I repeat myself a lot, until I remember the corner stones of the melody. Next I need to remember the directions up and down or the decorations.
But what's really helping for parts hard to keep in mind: Depending on the instrument played, I visualize the notes I tend to forget on the fretboard or keyboard as I'm playing the accompanying harmony.
If I don't get that troublesome note fast enough while playing: I stop improvising until I do see the note I want to sing in my chords, or around my chords. That helps me really a lot for the parts that are still really new.
I help myself with the doremi: I have a good memory for motifs, if I remember e.g. miredo tilasila so fa .... then I can remind the whole rest of this composition.
But here are more anchors to remind this motif: e.g. the chord progression, I-vi-ii-V, the motif (hint: scale, turn etc.).
But the easiest way is to find an already existing song that has some associated tune, chord, rhythm or even lyrics. As I know thousands of songs I always find an association - it‘s almost impossible to have a musical idea that don‘t remember to another song.