writing the codes in text file