How do i make it when you click a tree it plays a certain animation and gives you an item

the title explains it all i want it to be when u click a tree a certain animation plays and once the animation is over you get an item.

or during the animation it gives you items until its over...

First you need to build a ray from the mouse position, and cast that ray into the scene with Physics.Raycast. There are several examples out there on how to do this. Then you can do something like (just an example!):

if(Physics.Raycast(...)){
    animation.Play();
    yield WaitForSeconds(animation.clip.length);
    GiveItemToPlayer();
}