Split write_taffmat into fcns for dat and hdr