add save into file function