Move block to click

How to make this cube move to the position of the mouse and when the cube comes to a position, continues to move on?

To make the cube go to the position of the mouse you can do something like this:

public Transform cube;
public Camera cam;
void Update(){
if(Input.GetButtonDown("Fire1"){
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray))
                cube.position = transform.position;
}
}

Now, i dont quite get the “when the cube comes to a position, continues to move on”. Are you using a navmesh agent on it?