I am in awe of wharfinger's JavaScript acumen, but this is easier to do in an editor or from the command line.

In vi:

: (to get into edit mode)
1,$ s/$/<br>/g
:wq  (to write results and quit)

In EMACS:

(go to the top line of the file)
M-x replace-regexp (return) $ (return) <br> (return)

Using perl from the command line:

perl -pi.bak -e 's/\n/<br>\n/' my.txt  (unix shell)
perl -pi.bak -e"s/\n/<br>\n/" my.txt  (Windows cmd shell - note double quote, lack of space after -e)

You can omit the ".bak" if you're willing to risk not having a backup when you modify your file in place. If you don't have perl, why not? Unless you're reading this on your WAP phone, it's probably available for your computing platform.


Update: Ah yes, forgot to mention this: if you want to use stdin/stdout, just omit the -i (and the .bak if you're using it), thus:
perl -p -e 's/\n/<br>\n/' <my.txt >mybr.txt  (unix)
perl -p -e"s/\n/<br>\n/" <my.txt >mybr.txt  (Windows)

You could also make a small script that would accept stdin and act as a filter, such as:

#!/usr/bin/perl (or wherever you've put it)

while(<>) {
     s/\n/<br>\n/;
     print;
}

Perl is fun!

Oh, and in answer to wharfinger above: I'm partly in ironic mode (since the script on inspection is completely understandable to even a JavaScript novice like myself), but partly impressed that you would think to whip up such a thing up in JavaScript so that anyone, even the poor perl-less folk, can do it. It's lovely--really. So on the whole it was intended as a compliment. And indeed I am a JS-dummy: what I do for a living is very non-webbish, so everything I learned about HTML and (now) JavaScript I owe to y'all here at E2. Thanks!