I used this script for years on my VPS. And it\'s still working.
DBLIST=`mysql -uroot -pROOT_PASSWORD -ANe\"SELECT GROUP_CONCAT(schema_name) FROM information
Make sure the folder /home/backup/db/ (which your are using to store the backup) has write access permission (to quick check: try using chmod -R 777 on that folder and run the script to make sure).