catalog.AppendChild(catalog);
How do you expect that to work?
It appends the node to itself as a child node!
Even if it worked, when you tried to write it to a file, it would loop infinitely trying to get to the end of the children ...
Did you mean to add it to the
parametre
instead?