I recommend first a few activities to get yourself used to simply writing & making up melodies.
1) Improvise a lot. The best thing to start out with is to limit yourself to something small and manageable, like a 5 finger pattern, black keys, etc. At first if you don't know what to play, just start playing anything. Allow yourself to babble. Once you get comfortable with this, then try thinking or "listening" for what should come after your first note, and try to reach that. At first, you may not get it, but the more practice you have at this, the more accurately you will be able ot match what you "hear" in your head. Record yourself doing this, and if you find something you like, write it down.
2) Start writing. Get yourself some staff paper, and just start writing. Do whole note or just note heads and fill up the whole page. Then play what you've written. If you don't like anything, that's ok, throw it away and do the same thing the next day. If you like something, keep that and throw away the rest.
3) Once you have an idea or two that you like from the steps above, then you go into making a piece out of it. I recommend writing a two-part canon to start, because it is very focused on writing melodies, but you learn how to do some counterpoint harmony as well. Let's say your melody will be the beginning of the piece (but it may not be...if it's the end or somewhere in the middle that's OK). On your staff paper, fill in the first measure or so with your melody. Then in the staff below that (the 2nd instrument) skip the first measure, and copy the first measure from the first instrument into the 2nd measure of the 2nd instrument. Now you need to compose a melody that fits with the 2nd instrument's 2nd measure. Once you write that measure, then copy it into the 2nd instrument's 3rd measure, and so on. This "diagonal" way of composing is actually quite fun, and you can create a somewhat complex sounding piece.
There's a lot more that can be discussed, of course, but hopefully this is enough to get you started. Feel free to PM me if you have any further questions.