One of the best ways to start writing an original melody is to start listening to numerous existing melodies. This will infuse your musical brain with many of the structural elements that constitute a good melody. Some of these elements are:
overall contour or the melody;
repeated rhythmic patterns ;
relative distribution of long and short notes;
diversity of melodic intervals;
suggestions of modulation;
Listen to the following melodies, and consider the above micro-elements: