Npm ERR! engine Unsupported engine

Indeed you must have got the mysql node installed on the device even if you don't need/use it. so you need to uninstall it first. I'm not sure how you do that on that particular device - but on standard linux machine you would go into your .node-red directory and run npm uninstall node-red-node-mysql and then reboot.
Sadly by then trying to upgrade Node-RED you have updated a load of other libraries and nodes which are now broken - so yes - you are now in a place where either you go back to clean install and just install the nodes you need (and not mysql) - or as Colin says find out how/if the device can be updated to use nodejs 18 or 20.