Something like this:
string appPath = Request.PhysicalApplicationPath;
string filePath = appPath + "Text.txt";
StreamWriter w;
w = File.CreateText(filePath);
w.WriteLine("This is a test line.");
w.WriteLine("This is another line.");
w.Flush();
w.Close();
Btw, I would not recommend to write it in the root of your website as the process would need write permissions. It's better to create a sub directory and write your files there.