I'd change the way I did this: read your data and build an "internal model" of what it should look like using classes - possibly something like this:
public class FullRow
{
public string Header1;
public string Header2;
List<Coord> Coords = new <List<Coord>;
}
public class Coord
{
public string X;
public string Y;
}
And then create a List of FullRow instances to hold it all.
Then read your data into those classes, check it read it ok, and override ToString in both classes to "prepare" the data (including your spaces).
That way, your data starts to "organise itself" and instead of a rather messy "read and print differently" method, you end up with cleaner code:
Coord returns the two values, separated by a space, FullRow returns as string with your two header values, and loops though it's collection adding spacing and line breaks to the Coord ToString return.
Keep It Simple: give each method one job to do and let data handle itself: Read all the data into an array, and process the whole array as input (which lets you "look ahead" to see if you are at the end, instead of reading a line at a time).
When you try to combine four functions in one method (reading the file, breaking the file up, formatting the result, and outputting the final file data) you end up with confusion and that makes it hard to work with, hard to test, and hard to maintain.