When creating a modal melody follow these simple rules:
1.Emphasise the tonic (I) note of the mode. The duration of tonic note should be longer than the duration of other notes and it should occur more frequently.
2. Emphasise the characteristic pitch of the mode. (In D Dorian: D - B)
3. Melodic cadence, or resolution II - I or VII - I is significant in confirming the authenticity of the mode.
But, before we start working on more sophisticated melodies, here's an example what a simple melody looks like, along with applicable harmonic functions: