Of course it’s possible.
I’d probably create a bool and call it ‘followingMouse’. Then in the OnMouseDown() function toggle that (followingMouse = !followingMouse). In Update() use an if-clause to ask if followingMouse is true. If it is, set the position to the mouse’s position.