Arduino code for sound sensor moving servo arm

First of all, do you have a 3-pin or a 4-pin sensor?
Could you send a picture of your wiring setup?

Depending on the type of the sensor there are different ways to set it up and send TRIG signals before reading the return value from the sensor each time.

Then, once you get it setup correctly, you should filter out any values outside of the valid range (by simply ignoring them) and only command arm movement after sensing certain in-range value more than once or by doing some sort of smoothing.