-shove-
I'm not sure exactly what your getting at but I from what I get your having problems with thinking of program design and how to go about attacking a full fledged script.
Pretty much like what tempest said I like to break down exactly what has to happen. Roughly at first, and then go inside each step and say EXACTLY what needs to happen for this step to work and to get you to the next step.
Then once you have all your steps down you may very well, especially with a login script, need more than one file. So you look at each file and then begin to write out your steps, except in syntax and not words.
I tried my best

. Hope that helps you a bit.