Manual:ExportSites.php

Details
exportSites.php maintenance script exports site definitions from the sites table into XML file.

Arguments
exportSites.php accepts only one argument.

Common error
It comes when the user running the script does not have permission to write the file.
 * Failed to open $file for writing.

Check user's permission. If you are root user then you can run script with sudo.