Stochastic thermodynamic cycles of a mesoscopic thermoelectric engine