Writing Loop content as Xml