please help with my melee attack animation

so i have this attack script and i can’t see how i would put a animation of my sword swinging in it as well so it actually looks like i’m attacking instead of imaginary damage dealing here is my script i’m using C# and i just really need some help soon please

public class PlayerAttack : MonoBehaviour {

	public GameObject target;
	public float attackTimer;
	public float coolDown;
	
	
	// Use this for initialization
	void Start () {
		attackTimer = 0;
		coolDown = 2.0f;
	}
	
	// Update is called once per frame
	void Update () {
		if(attackTimer > 0)
			attackTimer -= Time.deltaTime;
		
		if(attackTimer < 0)
			attackTimer = 0;
		if(Input.GetKeyDown(KeyCode.F)) {
			Attack ();
			if(attackTimer ==0){
				Attack();
				attackTimer = coolDown;
			}
	}
}
	private void Attack() {
		float distance = Vector3.Distance(target.transform.position, transform.position);
		
		Vector3 dir = (target.transform.position - transform.position).normalized;
		
		float direction = Vector3.Dot (dir, transform.forward);
		
		Debug.Log (direction);
		
	if(distance < 2.5f) {
		if(direction > 0) {
			EnemyHealth eh = (EnemyHealth)target.GetComponent("EnemyHealth");
			eh.AddJustCurrentHealth(-5);
		
		
}	
}
}
}

I would put it in Attack like this. I have not tried it so report if that fails.Note also that I have slightly altered some parts of your code:

public class PlayerAttack : MonoBehaviour {

    public GameObject target;
    public float attackTimer;
    public float coolDown;

    // Use this for initialization
    void Start () {
       attackTimer = 0;
       coolDown = 2.0f;
    }

    // Update is called once per frame
    void Update () {
       if(attackTimer > 0)
         attackTimer -= Time.deltaTime;
       else 
         attackTimer = 0;
       if(Input.GetKeyDown(KeyCode.F)&& !animation.isPlaying) {
         Attack ();
         if(attackTimer == 0){
           Attack();
           attackTimer = coolDown;
        }
      }
  }
  private void Attack() {
    animation.Play("Attack");
    float distance = Vector3.Distance(target.transform.position, transform.position);    
    Vector3 dir = (target.transform.position - transform.position).normalized;
    float direction = Vector3.Dot (dir, transform.forward);
    Debug.Log (direction);
    if(distance < 2.5f) {
       if(direction > 0) {
         EnemyHealth eh = (EnemyHealth)target.GetComponent("EnemyHealth");
         eh.AddJustCurrentHealth(-5); 
       }   
    }
}
}