Hi and welcome to Knitting Help!
You knit two, bring the yarn to the front between the needles and purl two, then take the yarn to the back, again between the needles. I'm notsure what is giving you the line of yarn. Do you think you could oost a photo?
Here's a video
which you can pause to see if you're doing the rib the same way. (How you hold the yarn is an individual preference.)