How to change a sprite movement direction onclick or touch?

I have a sprite which is moving up , and in the code i also have the part if the scree is touched this sprite should change its derection to left, but instead it just goes a bit left and afterward it goes up again.

void Update()
	{
		transform.position += Vector3.up	 * Time.deltaTime;
		if (Input.GetMouseButton (0)) {
			transform.position+=Vector3.down *Time.deltaTime;

		}
	}

Vector3 direction = Vector3.up;

void Update() {
transform.position += direction * Time.deltaTime;
if (Input.GetMouseButton (0)) {
direction = Vector3.down;
}
}