Enemy is updating the target position

[SerializeField] private float speed;
[SerializeField] private Transform pointA, PointB, player;

Vector3 CurrentState;
Vector3 movemente;

// Start is called before the first frame update
void Start()
{
    CurrentState = pointA.position;
}

// Update is called once per frame
void Update()
{
    transform.position = Vector3.MoveTowards(transform.position, CurrentState, speed * Time.deltaTime);
    if(transform.position==pointA.position)
    {
        CurrentState = PointB.position;
    }
    if(transform.position == PointB.position)
    {
        CurrentState = pointA.position;
    }
    
    
    
}
private void OnTriggerEnter(Collider other)
{
    if(other.gameObject.CompareTag("Player"))
    {
        CurrentState = player.position;
        
    }
}
private void OnTriggerExit(Collider other)
{
    if(other.gameObject.CompareTag("Player"))
    {
        CurrentState = pointA.position;
    }
}

in this code the enemy is not updating the target/player position.
like if the player enter by triggering the collider the enemy take that position and move towards that position and stops right at that position and when the player exit the collider it will go at patrolling state.
I want the enemy continuously update the player position while the player is in the collider.