Added function write_list_to_text_file