Preheat oven to 180 °C. Heat a non stick pan, pour milk into it. Add rice and mix and cook, stirring so that the milk does not burn. Add coconut milk and mix.
Add star anise and sugar and mix. Add scraped coconut and mix and let the mixture come to a boil. Remove the star anise and discard. Pour the mixture into a silicon mould. Add butter and cover the mould.
Keep the mould in the preheated oven and cook for 30 minutes. Check to see if the rice is done. Cook for some more time if the rice is not cooked. Remove the lid and bake for 15 minutes or till a crust is formed on top. Serve hot.