Hi Lilianna,
you're asking a one million dollars question ...
well, you're from UK, right? I had some collaborators there.
Ok, as for the direct answer for your request, I could propose a method of one of the greatest songwriters ever, Robin Gibb (Bee Gees)
and that's exactly that method:
prepare 1 mic and 2 units (or 2 software) - one for playback and another for recording...
then find a "repeat" knob on the playback unit and press it,
then switch on your recording gear(software)
then switch on your playback gear/software with that beat you willing to make a top line to
Now begin to sing what you have on your mind while the beat is playing, the melody that appears will be recorded,
don't neither think nor analyze what you're doing, just sing over and over! Many times, different melodies will be recorded good or bad, no matter!
then you may check out what you recorded, and this is a time for analyze, edit, improvement etc.
Hope this helps
PS. I do have the beats too