About hearing notes in your mind: if you can firmly hear one note in your mind, the mind will usually wait to “play” the next note for you until you’ve done whatever you have to do to figure out what the first note was. It’s as if the notes are sort of already in a tube waiting for you and you can take them out one at a time. They won’t all disappear (usually!). If the “cosmic radio” metaphor doesn’t resonate for you, maybe think of the process as a “musical Pez dispenser.”
It takes a while to trust this process. Use whatever it takes to facilitate identifying the pitches: take an ear-training class, sing them into a tape recorder, use your music software to find them, find them on a keyboard or some other instrument, record them and painstakingly identify them one note at a time in the editor, guess (sometimes you’ll be right).
I recommend singing them and taking an ear-training class. Those two things are part and parcel of the same skill. Secondly, my next preferred method is finding them on a keyboard. The danger with that method is that all too often, the fingers will “do the talking,” and what they come up with isn’t what you heard.
But, as you develop your ear-training skills, usually the notes will be there in your “cosmic radio,” waiting for you. Try singing. It strengthens your ear and also keeps you honest so you don’t write “paper music.”