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);
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.
Inclue System.IO namespace.