Continuously write the output that is displayed in the "Replies" window to file?

I have a script that produces very much “replies”, more than Script Editor can display (there seems to be a limit about 100 kB per execution). For debugging purposes I need to see the whole log. How can I write the whatever the script outputs in the Replies-window to file as text? Preferably continuously while the script is running in case it crashes.

Can you post the script?
Or a sample of the log file you are expecting?

set logtext to "sample log text"
do shell script "echo '" & logtext & "' >> ~/logfile.txt"

each time you run the do shell script above, it appends a newline to the logfile.txt