Read up on vector math and find some vector math library. It's not very hard and once you grasped the idea, a lot of possibilities will open for you.
But how do I find the x,y coordinates of the red wall to move it to that direction? How much the the x,y needs to be increased/decreased while the button is pressed?
A 2D-vector consists of x and y components. You can calculate a direction vector by subtracting the x and y components of starting point from x and y components of the target and normalize it. You can then multiply your direction vector with some velocity and a time to get the position of a moving object at the desired time.
Again, read up on vector math! It's important for games!!