This LINQ to XML code should do it.
Notice that, AFAIK, stuff like <Gruopid = 1> is not valid XML. You need to define an attribute like this : <Gruopid id="1">.
using System;
using System.Xml.Linq;
class Program
{
static void Main()
{
XElement GroupDetails = new XElement("GroupDetails");
XElement g1 = new XElement("Gruopid", new XAttribute("id", 1),
new XElement("GroupName", "XYZ Education 1"),
new XElement("GroupAddress", "Delhi"));
XElement g2 = new XElement("Gruopid", new XAttribute("id", 2),
new XElement("GroupName", "XYZ Education 2"),
new XElement("GroupAddress", "Mumbai"));
XElement g3 = new XElement("Gruopid", new XAttribute("id", 3),
new XElement("GroupName", "XYZ Education 3"),
new XElement("GroupAddress", "Noida"));
GroupDetails.Add(g1, g2, g3);
GroupDetails.Save("ankit.xml");
}
}