added function to save the word probability to txt file