xxxxxxxxxx
StreamWriter SW = new StreamWriter("Filename.txt", true);
overwrite text in file
xxxxxxxxxx
System.IO.File.WriteAllText(@"D:\path.txt", "Hello, world!");
xxxxxxxxxx
StreamWriter SW = new StreamWriter("Filename.txt", true); //to append
StreamWriter SW = new StreamWriter("Filename.txt", false); //to overwrite