If you heat Coca‑Cola long enough, will it turn into a black sludgy substance ?

Yes. Coca‑Cola slowly thickens when boiled as a result of the water in the drink evaporating. Once most of the water is gone, the sugar begins to burn. You’ll get a similar effect if you boil orange juice or any sugary liquid for long enough.