Hello, How are you doing ?
Well, I have been programming in shellscript since 2005, because I started on Linux world with debian, Conectiva, Red Hat and so on. Besides that, I was C/C++ programmer in my school time and it gave me a strong base in programmation. So, I mean, today, I use shellscript a lot to automate my process, to do moving or transfer environment like yours, or Help ansible team to think in a strategic to deploy something.
So, if your explanation (and logic) is correct, I can do this script, it will be very similar when I was Unix Administrator on DXC Company ( former HP) and I helped to change all IP, Hostname and DNS in 600 servers on Dev environment. ( It was "moving network" project)
However, ping me and let's talk about details, I can discuss about the script.
Best Regards