Export output to a text file

Here is an approach that address the core of your request

First strip the values from the Association and group them with Partition.

z1 = Values[coord] // Partition[#, 3] & ;

Now create a file variable

theFile = File["exportFile.txt"];

Export as follows (using "Table" argument to Export

Export[theFile, z1, "Table"];

This file will end up in the directory referred to by Directory[]

---x---

Now a little more complication

Add a columns of row indices to the left of your table with (I think it is convoluted syntax, but it works....)

z2 = Insert[z1 // Transpose, Range[3], 1] // Transpose;

The next picture shows z1 and z2.

enter image description here Add a row of labels to the top of your table

z3 = Prepend[z2, {"index", "x", "y", "z"}];

And then Export the variable z3 instead of z1 as above.

The only problem is the labels aren't aligned properly; this could be a problem or not; depending on how you will use the exported file.

enter image description here


If this is really the structure, maybe you could use a dataset instead?

pdata = Partition[coord/. h_[i_Integer] -> h, 3]
ds = Dataset[Association @@@ pdata]

Indexes are supplied automatically. E.g.,

ds[[1]]