How to intigrate Enemy animation blend tree to movement script

I am having trouble playing an enemies animation movements when they are following the player. I have the animations set up in a blend tree for 4 directional movement but don know how to link it to a script that follows the main player.

Here is my code so far.

public class EnemyMovement : MonoBehaviour
{
public float speed;
public float stoppingDistance;

private Transform target;
// Start is called before the first frame update
Animator animator;


void Start()
{
    target = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
}

// Update is called once per frame
void Update()
{
    
    

    if(Vector2.Distance(transform.position, target.position) > stoppingDistance){
        transform.position = Vector2.MoveTowards(transform.position, target.position, speed * Time.deltaTime);
    }
    
    animator.SetFloat("Horizontal", transform.position.x);
    animator.SetFloat("Vertical", transform.position.y);
    animator.SetFloat("Magnitude", transform.position.magnitude);
}

}

this is my code, hope it helps!

void Start()
{
rb = GetComponent();
anim = GetComponent();
target = GameObject.FindWithTag(“Player”).transform;

}

void Update()
{
    if (Vector3.Distance(transform.position, target.position) < distance)
    {
        anim.SetBool("moveTowards", true);
        //go to player position
        transform.position = Vector3.MoveTowards(transform.position, target.position, speed * Time.deltaTime);
        MoveDependOnPlayer();
    }
    else
    {
        anim.SetBool("moveTowards", false);
    }

}

void MoveDependOnPlayer()
{
    //convert position from world to local space
    relativePoint = transform.InverseTransformPoint(target.position);

    if (relativePoint.x < 0f && Mathf.Abs(relativePoint.x) > Mathf.Abs(relativePoint.z))
    {
        anim.SetFloat("Blend", 0.3f);
    } 

    if (relativePoint.x > 0f && Mathf.Abs(relativePoint.x) > Mathf.Abs(relativePoint.z))
    {
        anim.SetFloat("Blend", 0.1f);
    }

    if (relativePoint.z < 0 && Mathf.Abs(relativePoint.x) < Mathf.Abs(relativePoint.z))
    {
        anim.SetFloat("Blend", 0f);
    }

    if (relativePoint.z > 0 && Mathf.Abs(relativePoint.x) < Mathf.Abs(relativePoint.z))
    {
        anim.SetFloat("Blend", 0.5f);
    }
}

I used 1D blend type and use the blend parameter and feed the animation the float value