Also, using the serial connection isn’t a viable solution for a long term project. You might be better using a an ESP8266 based device such as a NodeMCU, although it depends on who you’re driving your servos.
You’re unlikely to find anyone on this forum who will re-write your code for you, and you need to learn yourself anyway.