It would be perfectly understandable if you thought that a melody was a series of musical notes. But you would be wrong.
And if you imagined that learning to write melodies involved getting to know all the notes and how they interact with each other, that too would be an understandable mistake.
When you have to perform a melody, notes are the first thing you think about. First you learn to sing or play the notes correctly. Let's call that phase 1 of learning a song. In phase 2, you start to grasp and internalize what the melody is expressing. And finally, if you're successful at learning the song, in phase 3 you recreate the melody in a performance that could easily feature some notes that are different from the ones written in the sheet music.
When it's time to compose a melody, notes should be the last thing you think about. And I mean that in the most literal sense. If we break up melody writing into three phases, you don't pick specific notes until phase 3.
First, in phase 1, you think about what you want to express (often looking at a set of lyrics that have already been written). In phase 2 you try out musical gestures, which take the form of shapes and rhythms, until you find gestures that achieve the musical effect that you're looking for. Finally in phase 3, you work out specific notes for each of the gestures, perhaps making accommodations to fit the notes into a set of chords that have already been written.
In reality, songwriters often find that melodies pop into their head, fully formed and ready to go. They jumped directly to phase 3. That's fine! But you can't rely on inspiration to always be there when you need it, and you can always get strong results if you work out your melodies systematically, step by step.
If you still believes melodies are series of notes, try this exercise. Take an extremely famous melody, and recast its notes in a completely different rhythm. Turn short notes into long notes, and turn long notes into short notes. Take out the original rests, but insert other rests in different places. Finally, ruin the shapes of the phrases by taking the highest notes and putting them one octave lower, and putting some of the lowest notes an octave higher.
If you make all those changes, you will have a new melody that shares the exact series of notes with the melody you started with, but no one will ever be able to guess the original melody when you play them the transformed melody. Even if you tell them "This melody has exactly the same notes as [name of famous melody]," they will insist that you are mistaken. It couldn't be the same, because it sounds completely different.
As a followup exercise, you could try taking another famous melody. Keep its exact rhythms, and keep the shape of every phrase and figure, but change every note so it's a different pitch from the original note. If you play this transformed melody for someone, there's a chance they will recognize the song you started with. Then they might add, "but it sounds weird -- you're not playing it right."
Notes do matter. You can't get all of them wrong without ruffling some feathers. But the identity of a melody comes from its shapes and rhythms. And if you want to write good melodies, you'll spend a lot more time on shapes and rhythms than you will on notes.
Tuesday is Beastly Fundamentals Day.