Writing data out text format