function to write population object to the disk
spacing