Changing the variable of a script on a collider object in on trigger enter with a delay

So I am trying to have a unit attack another unit through a melee combat style, I can’t have it access the variable directly from the ontriggerstay2d function because it dies to quickly, so I need to do it through an Ienumerator(unless someone knows a better way). Here is the only code that should matter

void OnTriggerExit2D(Collider2D other)
{
    if(other.tag == "Enemy Troop1")
    {
        stay = false;
    }
    else if(enemy && other.tag == "Troop1")
    {
    
    }              
}

IEnumerator Attack(float cooldown)
{
    yield return new WaitForSeconds(cooldown);               
}

Try something like this:

	bool attacking;
	public int damageIShouldDo;
 OnTriggerStay(Collider col)
	{ //If I am in range of another thing, and that thing is my enemy...(not my team)
		if(col.tag == "RedTeam" && !attacking && gameObject.tag != "RedTeam" ||
		   col.tag == "BlueTeam" && !attacking && gameObject.tag != "BlueTeam"){
			//Start a coroutine to attack him, so long as I'm not already doing that.
			//pass the damage and the thing I just collided with as parameters for the 
			//coroutine, so the coroutine knows what to attack and how much damage
			//to do.
			StartCoroutine(Attack(damageIShouldDo,col.gameObject));
		}
	}

	IEnumerator Attack(int damage,GameObject myTarget)
	{
		//wait 1 second before attacking
		yield return new WaitForSeconds(1);
		//access my enemy's script, and subtract the damage.
		myTarget.GetComponent<EnemyScript> ().health -= damage;
		//set attacking to false so that we know we can attack
		//again.
		attacking = false;
	}