It's normal for the sugar to get clumpy or grainy while making caramel. Just make sure you keep the heat at its lowest flame and keep stirring and eventually things should come together! Avoid getting any moisture into the caramel so the sugar doesn't crystallize.