How to stop my character from moving when mouse is clicked.

I am trying to build a simple game where a character falls from the sky and the player clicks on it to destroy it. I am just learning how to use unity and all the commands that come with it but I know how to code. Right now I have written a script to allow the character to fall from the sky in a loop and want it to stop when I click on it. Once I learn that I’m sure I can get the rest. Here’s my code:
#pragma strict

    var pointB : Vector3;
    var freeze = true;
    function Start () 
    {
    	var pointA = transform.position;
    	
	    while (!freeze) 
	       {
		    yield MoveObject(transform, pointA, pointB, 3.0);
		   
	       }
    }
     
    function MoveObject (thisTransform : Transform, startPos : Vector3, endPos : Vector3, time : float) 
	{
	    var i = 0.0;
	    var rate = 1.0/time;
	    
	    while (i < 1.0)
	        {
		    i += Time.deltaTime * rate;
		    thisTransform.position = Vector3.Lerp(startPos, endPos, i);
		    yield;
	    	 }
    }
    
     function Update() {
    if(Input.GetMouseButtonDown(0))
      destroy();
    }
    
    function destroy()
    {
    freeze = false;
    }

The character continuously falls just fine but doesn’t stop when I click on it. Am I doing something wrong?

function destroy()
{
freeze = true;
}