Thank you so much for getting back to me! A lot of my questions have been cleared up after reading your response. I just have one more question.
So in the 3rd bar, the E is being used to simply connect the chord tones and those tones are placed on the off beats to give it a unsettling sound. I understand that and it makes sense, however was the E used because it is so close to the D and F#? Could another note have been used for it or would that not work since it would be to large of a jump and would sound less connected.
Last thing, do you have any tips for melody writing as a beginner and how to grow to become a better one overtime?