I would like to print edible cookies or ornamentation for a cake.
Is printing with edible materials achievable by standard thermoplastic-like 3D desktop printer? Or you need to buy a special printer to do that?
You cannot print edible models using a "standard" consumer 3D printer without first installing an "hot end" capable of depositing edible - normally thicker - substances as well as a suitable extruder mechanism.
However, there are not necessarily any technical limitations in the electronics, software, slicers etc. in a typical printer that wouldn't allow you to install such an upgrade. For instance, you could calibrate your extrusion rate and nozzle width to suit batter and similar.
Some commercial printers, such as the DeltaWASP allow for upgrades that print clay, which wouldn't be very different from printing liquid food.
You can, but that doesn't mean it's very easy.
You don't have to buy a special printer, but you need a special extruder (such as http://www.structur3d.io/). Most of these systems can print anything with the consistency of Nutella. However, many parts of the printer may not be food safe.
Another option (if you simply want 2d designs) is something like the PancakeBot. It can probably also "print" with anything that has the same consistency of pancake batter.
MakerBot Industries had a mod available for their early open source machines called the Frostruder. It was basically a syringe connected to your print head. I saw this in action at the University of Washington a long time ago. Check out the legacy ReplicatorG in action!
I like to relate 3D printing as "A hot glue gun on rails". The beauty is that a lot of the home machines can easily be almost anything on rails.
So, you could always try to 3D print a solution of your own. Please keep in mind any federal regulations on food processing materials (ie ABS is not recommended for most food applications).