Fixed output of multiline string to file