If Kun has an unlimited supply of war beasts, hordes and hordes of Krath, tons of Massasi and fighters that can take out dreadnaughts, why was defeated by the Republic?
He was actually winning until Ulic Qel-Droma was captured and Mandalore the Indomitable was killed. Mandalore led the Fourth Battle of Onderon where he was killed. The remainder of the Mandalorians scattered at the loss of their leader, defeated by the alliance of Beast Riders and the Republic.
Then Ulic led the Republic to Yavin 4, where they cornered Exar Kun and imprisoned his spirit on the planet.
Exar Kun was dominating the galaxy, making his way to Coruscant and Tython before he was defeated.