I mean what parameters should a rocket engine that is used exclusively in space (last stage of a lunar rocket for instance) have?
This is a hugely open ended question and a very big subject, it's a bit like asking "what automobile is best for use on Earth?" I'll try to fill in some details.
There's the unique environment of space: zero-g, potentially very cold temperatures, vacuum, potentially long travel times (months or years), varying delta V requirements, etc. Each of those need to be dealt with.
Consider long travel times, a vehicle travelling to orbit Mars from Earth would be in interplanetary space for months between firing its main engines. That means the propellant used has to be highly storable. Cryogenic propellants (e.g. liquid Oxygen, liquid Hydrogen, liquid Methane) which would otherwise be excellent candidates for rocket propellants can be tricky to store due to the need to keep them extremely cold and vent inevitable evaporation, though with suitable insulation the vacuum of space makes this slightly less of a problem than it would be on Earth.
Then there's zero-g, how do you get the propellant from the fuel tanks into the rocket engine? If you use pressurized gasses this is easy, if you use a liquid there are some complications involved. On Earth this is easy, you pump an inert gas into the top of the fuel tank (ullage) which keeps the liquid under pressure and helps feed the propellant into the turbopumps. In zero-g of course there is no longer a "top" so it's necessary to apply a little bit of acceleration with a small ullage motor in order to get the ullage gas and liquid properly oriented and feeding correctly until the acceleration of the main engine takes over. Solid and gaseous propellants are easier to work with in zero-g but also generally have lower performance.
Dealing with cold temperatures and vacuum can be very challenging, a rocket may spend months or years in cold interplanetary space between uses, if not properly designed lines could crack, valves may leak, and the rocket could either become useless or destroy the vehicle. This is the suspected cause of the loss of the Mars Observer spacecraft, for example.
Additionally, there's the problem of starting or re-starting a rocket engine. A rocket used on a launch vehicle generally only needs to be started once, so using a simple pyrotechnics based ignition source is easy. But interplanetary rockets may need to be started many times (to provide course adjustments, for example). Using hypergolic propellants which ignite when mixed is a common choice, as are propellants which react when they come in contact with a catalyst (which is placed in the nozzle). Cryogenic liquids are more difficult to ignite and are thus less commonly used in this role.
Delta V and time requirements often dictate the available choices for propellants. If you need a lot of delta V and you have a lot of time to reach it then you could choose a low-thrust / high-efficiency engine such as an ion engine or hall thruster. If you have a lower delta V requirement then you can use a simpler or cheaper rocket and propellant such as a solid fuel rocket, a gaseous mono-propellant engine, or even a cold gas thruster (which is literally just pressurized gas such as Nitrogen expelled through a nozzle). If you have high delta V requirements and a low amount of time with which to apply it (such as orbital insertion for a planet or very large moon) then a higher performance bi-propellant or even cryogenic propellants might be necessary. Or even more advanced engines like nuclear thermal rockets.
For the landing stage on a lunar lander the requirements are actually not that extreme, since the local gravity is low. Most of the conventional propellants used in interplanetary spacecraft will work ok, additional options include high-test peroxide (a catalyzed mono-propellant or an oxidizer), or various uses of N2O4 and Hydrazine or derivatives (which is what the Apollo LM used).