Coroutine help

Hi, I am working on a AI. It follows the player etc. I am however stuck on getting the AI to damage the player. I seem to be able to get it to actually do the damage, however it does it all in a split second. What I mean is I have set the coroutine to pause every x amount of time, however it seems to just pause for x amount of time than automatically damage the player/kill the player all at once in a second. Here is a snippet of my code maybe someone can explain what is wrong? Thanks in advance.

public class AI : MonoBehaviour
{
    //Variables
    public Vector3 targetPosition;
    private Vector3 targetDistance;
    public int attackRange;
    private bool ableToAttack;
    public int attackDamage;
    public float attackPause;
    private bool alwaysLoop = true;

    public void Start()
    {
        StartCoroutine(attackWait());
    }
   
    void Update()
    {
        if (targetDistance.sqrMagnitude < attackRange)
        {
            animation.Stop("run");
            animation.Play("attack01");
            ableToAttack = true;
        }
        else
        {
            ableToAttack = false;
        }
    }
   


    IEnumerator attackWait() 
    {
        while (alwaysLoop == true) 
        {
            if (ableToAttack == true) // checks if it is able to attack the player
            {
                GameObject.Find("Player").SendMessage("Damage", attackDamage, SendMessageOptions.DontRequireReceiver); 
                //I am currently using a UFPS player, where this is how the damage is sent to the player
                yield return new WaitForSeconds(attackPause);
                //this pauses the ai (not sure if this is working properly)
            }
            yield return new WaitForSeconds(attackPause);
        }
    }
}

Change
StartCoroutine(attackWait());
To
StartCoroutine(“attackWait”);

the problem here in lies that you are setting a 1 second delay and it is only waiting one second so for every 100 seconds or 1 minute and 40 seconds it constantly attacking at one damage every second.

Now to be more fair on the player try setting it to 10 or 8 and the damage to 4 and the same for the player so the player has a chance of defeating the ai, but still fair, in the balance of gameplay.