Is it possible to clamp an animation on the last frame by holding down the mouse button?

I’m working on a character that has multiple spellcasts and was wondering if it was possible to stop the animation on the last frame while you’re holding down the mouse button to delay the spell from exiting the empty game object. I’m using Input.GetMouseButtonDown