added function to write passwords to a text file.