I want to encode a python command in the terminal but it executes them as I press enter to go to the next line of command. How can I prevent the terminal from executing the command until I finish typing all the command lines?
It's not a bug, it's a feature :)
The "problem" that you describe is in fact what you usually want in an interactive environment, be it the Python interpreter itself, IDLE or ipython.
It you want an environment, where you can type a couple of lines and then explicitely let it interpret/execute, give the browser-based IPython Notebook a try.