To melt sugar, you need to raise its temperature to its melting point, which is around 365 degrees Fahrenheit (185 degrees Celsius). The temperature of the surface of the sun is much higher than this, but the intensity of sunlight reaching the Earth's surface is significantly reduced by the Earth's atmosphere. Even at the peak of the day, the sunlight reaching the Earth's surface has an intensity of approximately 1 kilowatt per square meter. This is not enough to raise the temperature of a sugar cube to its melting point.
Therefore, while a sugar cube placed in front of the sun would eventually warm up, it would not melt.