How to control a servo motor using a PID control with input from current sensor. I am not so proficient in arduino and in coding so can anyone please help me. I want to create a closed loop using pid for controlling servo with current sensor acs70331

I don't see a need for PID here, most especially to start with. A simple feedback loop where you close the gripper a bit at a time measuring current as you go until it's at the set point should do it.

If necessary you can make the algorithm more clever.

PID would actually be a problem I think because you not want any overshoot at all if the object being gripped is fragile.