Howdy,
it does not matter where you place the script, as long as you tell advanced launcher or rombrowser where it is. Just replace the retroarch command in these launchers with the path to the script. And make it executable first
$ chmod +x path_to_script
Curl is a program in Linux [1], you most likely have it already, so you should just try it out, I am more than sure it will work out of the box. In the script, there is variable called “address” you need to input the correct address for your Kodi setup, usually just change the port to what Kodi listens to, i.e. change the 8090 to whatever you can see in your Kodi settings (Settings Menu: “Kodi” -> “Web Server” -> “Allow Remote Control via HTTP” and check for the port). Last but not least make sure retroarch is actually in /usr/bin, you can check with
$ which retroarch
If it is not, just change the path in the script to the correct one.
I am glad I can help.