Error with moving object to mouse clicked coordinates. [SOLVED]

I made a little script that should take a coordinates an the move object to it.
But is moves object to an opposite direction.
I am workin with 2d scene.

Here is the code:

public Camera MainCamera; public LayerMask layers; public float movementSpeed = 20.0f; private bool IsMoving = false; private Vector3 targetPosition;

    // Use this for initialization
    void Start()
    {
        targetPosition = transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButton(1))
        {
            SetCoordinates();
        }
        if (IsMoving)
        {
            Moving();
        }
	}
    private void SetCoordinates()
    {
        Ray ray = MainCamera.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit, Mathf.Infinity, layers))
        {
            targetPosition.x = hit.point.x;
            targetPosition.y = hit.point.y;
            targetPosition.z = transform.position.z;
            Debug.DrawRay(transform.position, targetPosition, Color.red);
        }
        IsMoving = true;
    }
    private void Moving()
    {
        transform.position = Vector3.MoveTowards(transform.position, targetPosition, movementSpeed * Time.deltaTime);

        if (transform.position == targetPosition)
        {
            Debug.Log(targetPosition);
            Debug.Log(Input.mousePosition + " mouse pos");
            IsMoving = false;
        }
    }
}

Use ScreenToWorldPoint instead of Raycast

In 2D scenes like yours, use the Camera.main.ScrenToWorldPoint function instead of rays.
The Raycast is for 3d physics.
If you need to detect a hit on a game object, use Physics2D.OverlapPoint

Basic Example

var position = Camera.main.ScreenToWorldPoint(mousePosition);
var col = Physics2D.OverlapPoint(position);

Example for moving a target to mouse location

public class MovePointToPoint : MonoBehaviour {
	public float Speed = 5;
	Vector3 target = Vector3.zero;

	// Update is called once per frame
	void Update () {
		if (Input.GetMouseButtonDown(0)) {
			target = Camera.main.ScreenToWorldPoint(Input.mousePosition);
			target.z = 1;
		}

		if (transform.position != target) {
			float step = Speed * Time.deltaTime;
			transform.position = Vector3.MoveTowards(transform.position, target, step);
		}
	}
}