initial file write method