Running custom query save result to xml file
Sounds like a pretty simple custom Craft plugin.

You'd add a controller to your plugin and an action method and allow anonymous access to it.

Your method would run any queries you need and save the results to an XML file on the server somewhere.

Then setup cron to execution the action at whatever interval you want.

0 3 * * * curl -s -o /dev/null "http://mydomain.com/actions/myplugin/myaction"