I think the order of your code is illogical. Think about what you need to do step by step.
However as you’re new to Unity I think the function should look like this:
void OnMouseDrag()
{
if (Input.GetMouseButtonDown(0))
{
// you have a vector 3 position
v3Prev = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0);
}
void Update()
{
// Do your gameobject movements here
transform.position = v3Prev;
}
Assuming this script is attached to your object of course. This is untested as I am at work. Hope this helps