Hi,
I've reviewed the script you posted and noticed it has options for a lot of Linux distributions (including RHEL 5 which was last updated about three years ago). Do you actually need the different OS options? If you used just one distribution for the future setups (let's say Ubuntu as an example), it would greatly simplify the resulting script and allow me to complete the task in a short time.
Also, can you please elaborate on what doesn't work for you with the existing script?
I'll set up a test proxy for you to try shortly on one of my servers -- it uses Ubuntu as an OS choice hence the question above -- I'll have to configure it anyway for the demo.
By the way, if you set up new proxies regularly, it might be a good idea to automate the setup using Ansible -- in this case you'll only have to supply the inventory of the IP addresses of the host you need set up and Ansible would do the rest, allowing you to quickly set up and configure proxies regardless of the hosting provider (basically, the only thing needed would be a way for Ansible to set up the SSH connection to the server to be set up). We can discuss setting this up too if you're interested.
Looking forward to your answer.
Best regards,
Yuriy