add export to text file function