The claim that Beethoven wrote nothing while deaf is categorically wrong.
He began losing hearing ~1798 (age 28). By 1814, he was profoundly deaf. His greatest works were written after.
How? He composed internally—imagining sounds with perfect pitch memory. He felt vibrations through floorboards (legend: sawed piano legs off). He used conversation books for communication.
Deafness didn't silence him. It deepened his interior world—and the music that came from it.