This is definitely a good question.
One thing to note is the principle of prosody and how it applies here. If you're writing top line melodies, I'm assuming there's an instrumental track already laid out? If so, that's going to have a huge impact on what kind of melody you ought to write.
When a song is harmonically complex, with frequent chord changes, you'll very likely want to write a more static melody (Not moving up and down that much at all). (Lots of John Lennon songs are like this... I Am The Walrus, etc.)
Also, melodic lines should be written with language in mind if melody is coming first, just like if words are coming first you should keep the rhythm and tones of the future melody in mind. This overall cohesion and balance is prosody on multiple levels and dimensions. If you find this helpful check out my post on an expanded understanding of prosody.
So in that sense, if you feel like you're struggling with writing melodies, it may have at least something to do with the
Like any other kind of creative endeavor; you start by stumbling around, and you practice, you copy things you like, since what you like is already what's resonant with your own creativity, and your own style will emerge.
- Additionally, you could also just make a conscious decision as to
what kind of melodies you want to write and sort of just take charge of your development in a purposeful way.
Lots of interesting possibilities though.