<p>I search about that topic, but all what I found, was the mechanical part of the 3d printer. But I didn't find, how to program it using arduino.</p>

<p>I want to make a cartesian 3d printer. I don't have a printer yet, but I will buy all the components that I need actually.</p>

<p>I know, how to control stepper motors, but I don't know, how I can program it in order to make the shape that I want.</p>

<p>This is my question: what I need to learn in order to let this 3d printer make this shapes?</p>

Yes. 
Look up Arduino Ramps 1.4
http://reprap.org/wiki/RAMPS_1.4
Following the programing is all done for you in the firmware. That said you can edit it. Just open the firmware files -- it is compiled when you upload them. Generally however one usually sticks to the preferences header alone..
http://reprap.org/wiki/List_of_Firmware
Over all you are trying to reinvent the wheel. When I started 5-6 years ago it was barely a thing. Now you buy a proven kit and get to the printing. That said if you are truly interested in designing check out.
https://www.facebook.com/groups/cncbuilddesign/
If you want help on picking a kit. Or what I really think you are looking for. A good place to start. This is one of the larger 3d printing groups. Full disclosure I run this one, but at 6k members I don't recruit.
https://www.facebook.com/groups/3DPrinterHobbyists/
I got my start in reprap IRC
http://reprap.org/wiki/IRC
Be aware there are trolls that now camp the IRC looking to sell you a printer. I would not engage with them, their printers are usually overpriced and sub par.
Best of luck.
Most of all I think you need to know it's Reprap all the way. Reprap forums, Reprap printers, Reprap kits, Reprap community. All the commercial printers started off the reprap project. Even if you buy a makerbot (don't) it's Reprap in it's roots.
https://vimeo.com/5202148