The AppendText method creates a StreamWriter object that appends UTF-8 encoded text to an existing text file.
string fileName = @"C:fileName.txt"; FileInfo filetoappend = new FileInfo(fileName); using (StreamWriter sw = filetoappend.AppendText()) { sw.WriteLine("--------- Append Text Start ----------"); sw.WriteLine("New author started"); sw.WriteLine("a book on Files Programming "); sw.WriteLine("using C#"); sw.WriteLine("--------- Append Text End ----------"); } // Read all text string readText = File.ReadAllText(fileName); Console.WriteLine(readText);