If you are using the New Input System, to detect Mouse Down, below is the code to detect a continuous mouse down (PlayerActions is name of the Input Script - yours may be different)
private void Update()
{
float mouseDown = playerInputActions.Player.Movement.ReadValue<float>();
}
private void MoveToCursor()
{
if (mouseDown > 0)
{
/// code here
}
}