To cook an item you need to create a cooking recipe, and you'll need some sort of fuel as well, which you need to register as a fuel.
minetest.register_craft({
type = 'cooking',
recipe = 'group:tree',
output = 'candy:syrup',
})
minetest.register_craft({
type = 'fuel',
recipe = 'group:tree',
burntime = 10,
})