following code should help.
string updatedLines;
string[] lines = textbox1.text.Split("\n");
foreach (string line in lines)
{
Console.WriteLine(line);
string updateLine = line + "</" +line.Substring(1,line.IndexOf('>'));
Console.WriteLine(updateLine);
updatedLines += updateLine;
}
Now updatedLines variable will be your required string.
This considers your text is in a .text file and then reading it. You can replace it appropriately.
Hope that helps. If it does mark the answer as solution and/or upvote.
Thanks
Milind