Practice riding on the white line when you are calm and there's no traffic. Don't look down at the pavement right in front of you, keep your head up, and look down the road. Also, don't grip your handlebar too tight. You'll be able to tell whether or not you're on the white line because it's usually smoother than the road surface. Once you get that down, you should be able to maintain a straight line even when traffic is passing.