divided file write function