save to pos file function