Make util.c text_out_to_file() more efficient

Gather the characters for a line of text into a buffer and write the
line to file all at once instead of one character at a time.