strip is a good idea to avoid unnecessary whitespace. Alternative would be to use out.puts in the File.open block.