Simple javascript code that creates a webpage

Id like to run a very stupid script that will simply create this type of file:

text
text
text

text
text
text

text
text
text

… etc

It’s not the simple loop which bugs me but rather how to set up the javascript so it will create this while the page loads… How can i do it ?

Thnax

mlk