Movetowards position until new position has been given

Hi all,
I am new to unity and hope that I am positing this at the right spot.
I have some issues with my player movement. Within the (2D) game, the player is able to move on the x axis. Whenever the player collides with another object, the player will move towards a random position from a list (but is still able to influence the movement with own input from another script). I sort of got it working as the player moves to a random position and has influence. Though, once the given position has been reached, it does not keep moving towards this position til a new collision happened (and with that a new position), which is what I would like to happen. I tried several things such as placing pieces of code elsewhere and a bool to check whether a new position has been given, but I haven’t been able to find a solution online so far. I think it has to do with the “while function”, but I have no idea what to do differently at this moment. I’m kind of stuck at and would really appreciate any input that could help me to find a solution.

So in short what I need:
Collision → set a target → move towards target until new collision (even if target has been met in meantime)

Thank you in advance!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveToTarget: MonoBehaviour

    public Vector2 charpos1 = new Vector2(-1.5f, -2.5f);
    public Vector2 charpos2 = new Vector2(-4.5f, -2.5f);
    public Vector2 charpos3 = new Vector2(1.5f, -2.5f);
    public Vector2 charpos4 = new Vector2(4.5f, -2.5f);

    public List<Vector2> possiblePositionsVamp;

    private Rigidbody2D rb2d;
    public float speed;
    public float newspeed;
    public float newencounterspeed;     

    public Transform targetVamp;

    public bool craving;
    public bool lastCraving = false;

    void Start()
        //add to list

    // Update is called once per frame
    void Update()
        craving = GameObject.Find("Craving").GetComponent<Craving>().isCraving;

    void OnTriggerEnter2D(Collider2D other)
        if (other.gameObject.tag.Equals("Blockbar") == true && craving == false)
            //Debug.Log("Collision detected");

    IEnumerator moveVamp(Transform targetVamp)
        //decide on newTarget position for vampire
        int randomPosition = Random.Range(0, possiblePositionsVamp.Count);
        Vector2 target = possiblePositionsVamp[randomPosition];

         while (Vector2.Distance(transform.position, target) > 0.1f)
            transform.position = Vector2.MoveTowards(transform.position, target, speed * Time.deltaTime);
            yield return null;

        //print("Reached target");


not tested but tell me if it works try changing the while to this, and consider using update rather than a corroutine

   transform.position += (target - transform.position).normalized * time.deltaTime * speed;
   yield return null;