I found this dua in duas.org but I am wondering about the instruction to write on a piece of sugar this verse.
Proven Supplication for increasing memory ( Tohfatul Hashmiya)

Write on seven pieces of sugar and eat a piece everyday. Write on the first one:

فَتَعٰلَی اللهُ الْمَلِكُ الْحَقُّ.

Fataa’a’lallaahul malikul haqq

Supremely exalted is therefore Allah, the King, the Truth,[1]
I dont understand what is meant by sugar, is it the small sugar cube or any type of sugar.

Yes sugar cubes means any ordinary sugar cubes found in the market.