Okay music theory can be some complicated shit, but to start off as a beginner, instead of talking about harmonic 5ths and 7ths, etc, try this...
Make it fit to what you've already played. I'll spell it out for you. Say you played a real simple piano piece with the notes C, G, the next C, G, then back to C. Basically your "C" note is your <i>home key</i> and it's what you <i>should</i> come back to in your bass line. (But not always). Try to make the bassline with EXACTLY the same notes, and play EXACTLY the same thing. This sounds too layered, but it works. Sometimes it's a good start, if you're going to add more later. Now, play the same exact notes, but play a different rhythm than the piano part, still coming back to your <i>home key</i>, which would be "C". Now add a violin or synth, and sustain a "C" in the upper region of your keyboard. This is a basic harmony that is REALLY simple.
Bass lines are usually more simple than the accompaniments that are played on higher octaves, but you can always make funky shit and have a crazy bassline, with everything else simpler.
I would tell you that "it just comes natural to some people to have the ear for it, and to others it just doesn't" but that's pessimistic of me. There is a way you can learn, and it's through time and practice. Try writing down the exact notes you use when you create your first melody, and then structure around that.
Sometimes it's better to loop your first melody and not even touch the keyboard, and hum to it. It may sound better when you hum a bass line, record it, then find the exact notes you hummed later, once it's been recorded for notepad purposes. Sometimes when you touch a key or two, it messes up what was in your head when you thought a second ago "I'm gonna add some SICK shit to this!"
Be patient with it. You'll find a way to do it.