What kinda of program do I need to record a one part of a song, and then another,

Audacity, maybe?
" When the power of love overcomes the love of power, the world will know peace."-Jimi Hendrix
Are you using a real mic'ed amp, it's kinda hard. Are you using amp-sims and record the input signal, it's easy to flow well.

First off you need a D.A.W. (rec. program) that supports measures and beats, that's where audacity fails. You shuld play in beat with a methronome, that makes this 100 times easier to do.

In reaper you make one track with a subtrack (track that goes through the first track). Then first record the first riff in the first track, then the next in the subtrack, so the first track again, ... until you're finished.

If using real mic'ed amp, the subtrack isn't neccesary, just 2 plain tracks. REMEMBER, both tracks mixed equally. if using subtrack, ALWAYS leave it's volume and pan at standard level.

When every riff is recorded, cut of excess parts of the recordings to make them fit toghether, this will make it harder to hear if you "cheated".

Ok, so you think "what if I want to double track?"
Then just make another set of tracks and pan the first 2 tracks to left and the other two to the right.

I hope you got it now, if you don't understand something here, don't ever hesitate to ask.