PID running after reaches a point and how to change target value to inches?

void drivePID(double target){
 
 double error=6; 
 double prevError = 0;  // position 12ms ago
 double derivative;    
 double integral = 0; 
 // get position of four motors

  LFDrive.setPosition(0, degrees);
  LBDrive.setPosition(0, degrees);
  RFDrive.setPosition(0, degrees);
  RBDrive.setPosition(0, degrees);
    
 while (error>=1 || error<=-1){ 
   
  double LFMotorPosition = LFDrive.position(degrees);
  double LBMotorPosition = LBDrive.position(degrees);
  double RFMotorPosition = RFDrive.position(degrees);
  double RBMotorPosition = RBDrive.position(degrees);
  double kP = 0.6, kI = 0.0, kD = 0.0;
  double accelRate = 0.0;
 // get average of the four motors (sensor value)
  double averagePosition = ((LFMotorPosition + LBMotorPosition) / 2 + (RFMotorPosition + RBMotorPosition) / 2);
 
 // position
  error = target - averagePosition;
  // derivative
  derivative = error - prevError;

  // integral 
  integral += error;

 double lateralMotorPower = (error * kP + derivative * kD + integral * kI);
 if (fabs(target)/target==1){
   if(target<=error){
     accelRate += 1000;
     lateralMotorPower = accelRate;
   }
   else if(fabs(target)/target==-1){
     if (target >= error){
       accelRate += -1000;
       lateralMotorPower = accelRate;
     }
   }
 }
 if (lateralMotorPower >= 430){
   lateralMotorPower=430;
 }
 if (lateralMotorPower<=-430){
   lateralMotorPower=-430;
 }
 if(error<=0){
    integral=0;
    }
    
 LFDrive.spin(forward, lateralMotorPower, velocityUnits::rpm );
 LBDrive.spin(forward, lateralMotorPower, velocityUnits::rpm );
 RFDrive.spin(forward, lateralMotorPower, velocityUnits::rpm );
 RBDrive.spin(forward, lateralMotorPower, velocityUnits::rpm );
  prevError = error;
  task::sleep(12);
  
 

 }
}

PID keeps running slowly after it reaches the target. Any ideas? Also, ideas on how to change the target value aka drivePID(//target value) to inches?