Looking for some help in stopping this motorized potentiometer midway

i have study the code i made for you and build a mockup of your setup using a couple of resistor and a pot to simulate your setup
so here's a new one
just change the MotorMove Function with this one

 void MotorMove(int Target)
{ 
 int SenseVal=analogRead(Sense);
 if (SenseVal > Target)
 {
  do 
  {
    int Speed=map (SenseVal,SenseVal,Target,255,0);
    analogWrite (Enable,Speed);
    digitalWrite (PinA1,HIGH);
    digitalWrite (PinA2,LOW);
    SenseVal=analogRead (Sense);
  }
  while (SenseVal !=Target);
 }
 if (SenseVal < Target)
 {
   do 
  {
   int Speed=map (SenseVal,SenseVal,Target,255,0);
    analogWrite (Enable,Speed);
    digitalWrite (PinA1,LOW);
    digitalWrite (PinA2,HIGH);
    SenseVal=analogRead (Sense);
  }
  while (SenseVal !=Target);
 }
  
  if (SenseVal == Target){
    digitalWrite (Enable,HIGH);
    digitalWrite (PinA1,HIGH);
    digitalWrite (PinA2,HIGH);
}}

this code you must be able to change a few thing to suit your need.

  1. I use Sense as my pot analogRead. change that.
  2. digitalWrite (PinA1,LOW);digitalWrite (PinA2,HIGH); need to be change to
    digitalWrite (PinA1,HIGH);digitalWrite (PinA2,LOW); if the motor turn to the wrong direction.
    3)change the name of each int to be consistent with the one i post