How to write a Grid Sag DAT file programmatically