XmlDocument doc = new XmlDocument();
doc.LoadXml(<buttons></buttons>");
XmlNode btn = doc.CreateElement("button");
XmlAttribute btnName = doc.CreateAttribute("name")
btnName = btn_EditButton.Name;
btn.Attributes.Add(btnName)
XmlElement newElem = doc.CreateElement("x");
newElem.InnerText = btn_EditButton.Location.X.ToString();
btn.AppendChild(newElem);
XmlElement newElemx = doc.CreateElement("y");
newElemx.InnerText = btn_EditButton.Location.Y.ToString();
btn.AppendChild(newElemx);
doc.DocumentElement.AppendChild(btn);
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
XmlWriter writer = XmlWriter.Create("positon.xml", settings);
doc.Save(writer);
You should get something like this:
<buttons>
<button name="btn_EditButton">
<x>158</x>
<y>252</y>
</button>
</buttons>
Note that naming your button btn_EditButton is redundant, either call it btnEdit, or EditButton, don't do both.
Also, for multiple buttons, you should create a method:
private XmlElement CreateButtonNode(Button btn) {
}
In the main part of the program you would have main document and you would simply add created nodes (one call for each button).