You suffer from a browser compatibility problem. My guess is that you are testing your script with IE4 or higher.
Your script would work fine in Netscape, as long as you close some type of container for each output line (as you did with the <br> tags at the end.) IE, however, lives in it's own world and does not want to display anything untile is sees fit.
You can work around this problem by enclosing each output line in a "hard" container such as with a <P>text</P> or a <TABLE>text</TABLE>.
Hope this helps.
-- rich --