Getting a smooth rotation with Quaterminions slerp in IEnumerator

I’m trying to get an AI character to follow me around and I’m having some trouble getting him to face the object he is chasing. Here’s my code.

 IEnumerator UpdatePath()
        float refreshRate = .25f;

        while (target != null)
            hasTarget = true;
            Vector3 targetPosition = new Vector3(target.position.x, 0, target.position.z);
            Quaternion rotation = Quaternion.LookRotation(target.position - transform.position);
            transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.time * turnSpeed);  
            yield return new WaitForSeconds(refreshRate);

Right now it’s very janky. Every time the cycle repeats he snaps to face me instead of getting a smooth turn. is this somethin I should use Update for? or is there a better way.

What do I need to do?

For anyone else who is new to unity and is having this problem: I used Lerp which is a faster version of Slerp. My ai now turn in a much smoother fashion.