I started recording my own songs using your method, and I collected some useful tips.
First, be sure to use the Amp with a wall socket that provide you with a ground connection. Here in Europe would be a Schuko type plug.
It happened to me that if I didn't connect my amp to ground, I would get very strange background sounds that change as I touch the guitar in the different metal parts, because I was providing ground through myself.
Second, use a Line In/Mic plug that is as far as possible from an output from your card. I initially used a frontal connection that was close to the output, and I got bleeding sound from output again into the input. I later used a rear Line In connection that solved the issue.
One last tip, be sure to check amp's output levels and/or pc's input levels, it could be some clipping. Also try to use some other recording program, or listen through Windows own 'Listen to this input' option, to discard Audacity's fault.
And as Todd told you, an external interface would be the very best solution, and I extremely recommend it. What I disagree with is that I prefer to record guitars connecting them directly to Audio Interfaces, because you don't need to know miking techniques, and you don't get any external noise. You could even feed that Line Level signal from your amp into the Interface, if you really like your amp's sound.
FYI, I own a Line6 POD Studio UX1 that is not expensive (120$ at Amazon), and I am extremely happy with the perfect audio it records, plus it provides high quality outputs for your speakers/monitors. I even do live gigs with it. I love it.