Firstly, consider the shape of your melody - this is the most memorable aspect.Secondly, when combining a melody with chords, make use of tension and resolution around chord changes. A note which is a chord tone over one chord will have dissonance over another . Waiting to change the note, rather than changing it as soon as the chord changes, will add interest to your melody.Thirdly, it is important to repeat and transform ideas already used, rather than purely thinking 'what note sounds best next?' as this adds a sense of 'togetherness' to the whole melody. These ideas might be a rhythm, an interval, or a short motif, and it can be worth writing them down on a piece of scrap paper for reference.