Translation:Are you spending the class on writing letters?
Is it not correct to also say "Are you spending the class writing letters?"
I think spending/ using the hour would be correct solutions here, too, since "time" means hour as well as class and both versions make sense. Just reported it.
spend something in doing something or spend something on something should be the correct grammar in English, I personally remember it should be this, instead of the answer indicates spending hour on writing the letter
This sequence of words (in English) sounds very clumsy. "Are you using the class/hour to write letters?" would be better. So skip the preposition "on".