help with player movement

how can i make my ball when i click a mouse button to go up and move left and when i click a mouse button again to go down and continue to move right?
I tried whit gravity but it is not that good for controlling the ball .I use c#.

Well, one way is to set the position manually.

Judging from your picture it looks like the ball is just following a rail.

Pressing mouse button changes rail from top to bottom and vice versa.

Your picture and your description doesn’t add up. I wrote the example based on your written description so the ball goes left and right in addition to up and down. I made a revision which only goes right.