If the sugar syrup is undercooked barfi will not set. There are 2 options to fix this:
1. Cook the mixture again for 2 to 3 minutes on low heat and then spread it back on the baking tray.
2. Refrigerate for few hours. The burfi may become chewy or more fudge-like but will still taste delicious.