Differential equations for general SU(n) Bethe ansatz systems