I have been pretty occupied and have just got around to writing the dat file without the mesh, and yes it generates the mesh before it writes the dat file as you mentioned. It's not a big deal for me but I have more complicated meshes that I would like to do via headless mode on a HPC.
Would you happen to have any tips?