Simple answer:
1) Find your places of cadence (a "resting point" within the piece). It looks like bar 8 beat 3 is a good candidate for a cadence. Since your melody falls on E, and since (aside from the unorthodox ending on D at the end) your key is in C major, and since you seem relatively new to harmony, this should be a C major chord or A minor chord; write this down for later. For simplicity sake, your next cadence will be at bar 16, which would require you to not finish on D if you want a perfect authentic (a.k.a "final sounding") finish.
2) Find your rhythm. Your strong beats are 1 and 3, since throughout the piece you put emphasis on the 3 by using half notes on beat 3. Without worrying about notes, clap or tap a rhythm that you think sounds like it fits your melody while remembering that you keep emphasizing that third beat. Since the melody at those times has a half note on the third beat, this is an opportunity for your bassline to "take stage" and become pronounced.
3) Fill in your notes. Write down the notes at your cadences first (you will revise this later), then start writing down your notes with the ultimate goal of "resting" at the cadences; ensure that rhythmic bassline melody fits the same standards that you have been taught that makes a "good" melody.
4) Go back and revise what you wrote, since now that you have a complete or almost complete bassline to accompany your melody, you can now go in and make small adjustments here and there with the bigger picture in mind (...really in front of you....)
Complicated answer:
Learn harmony; learn harmonic progression. Then learn counterpoint and do a bunch of exercises.