added save diary to file function