You can buy the proper flashing to install it on a flat roof and a roof cap that has screen around it to prevent insects from entering.
Venting kitchen exhaust fan through roof.
Here you see a very good roof top exhaust hood made by ventilation maximum in quebec where they tend to make roof vents taller to avoid being buried in the snow.
Vent through the roof run duct work through the attic then attach the stove vent to a roof cap.
If you want to replace the range hood and exhaust fan above your stove and vent it to the outside and the stove is against an interior wall you have several options.
Vent your bath and kitchen exhaust fans through the roof through a special roof hood.
Also be sure to place your kitchen vent at least 5 feet upwards from the eaves of the roof.
On the outside you will see the wind baffle that prevents snow from blowing in.
That is five feet upwards along the slope of the roof and away from the bottom edge.
If it sits on an inside wall venting through the attic and out is a better option but if it is on an outside wall it is more practical to vent through the wall.
The duct for your exhaust fan needs to be run to the outside of the house to remove the chance of a fire hazard.
In either case do not vent into the wall or the attic.
Use a proper roof top exhaust hood if you must go through the roof.
Venting through a roof vent or exhausting them in the attic could cause moisture problems and rot.