You just need to write the string into text file and store it at desired path. Suppose your data is in string strValue:
string strValue = "your data";
FileStream fs = new FileStream("D:\\test.txt", FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
sw.BaseStream.Seek(0, SeekOrigin.End);
sw.WriteLine(strValue);
sw.Flush();
sw.Close();
this will create a file test.txt in your D drive if it doesn't exist. otherwise it will append. if u don't want to append and create new file everytime, you can just delete before writing.
if (File.Exists("D:\\test.txt");
File.Delete("D:\\test.txt");
Inclue System.IO namespace.