The easiest thing to do would just append that text to a System.Text.StringBuilder and then write the whole thing to the writer at the end instead of hitting it every line.