You probably want the burfi to be like the ones available commercially. To ensure the barfi retains its white colour you need to do the following:
1. Make the burfi using fresh coconut. Though many people use desiccated coconut for making the burfi, it is best to use fresh coconut, if you want the end product to remain white.
2. Do not roast the grated coconut too much. It should be roasted no longer than a minute or a minute and a half.
3. Use a heavy bottomed pan for roasting.
4. Stir the coconut continuously.
When you make burfi using fresh coconut and restrict the roasting to just over a minute the shelf-life of the end product reduces. The burfi comes out nice and juicy, but cannot be stored for too long, since the coconut has been kept almost raw.
Roasting the grated coconut will enhance the life of the sweet, but you will not get that white colour. Roasting the coconut automatically gives a colour to it.
Also, remember to add a tablespoon of milk, when preparing the sugar syrup (chashni). Doing so brings out the scum present in the sugar. You can scoop it out and discard it. Dirty sugar too can discolour the coconut sweet.
"A love affair with knowledge will never end in heartbreak" - Michael Garrett Marino