add code for write function

Functions to write file for data to GUI.
These functions still need a home, or a new Class.