Functionality of output stage of a cmos amplifier circuit
You're correct M16, M17, M18 and M9 are mainly for biasing. Note how they're all &quot;MOS diodes&quot;, all in series and between Vdd and ground. They are the biasing for M12 - M14.
At the same time M12, M19 and M14, M16 are current mirrors that push the current difference from the differential pairs in the direction of the output.
The biasing current through M16 - M19 is not constant, M1 and M3 add/subtract current and that influences the voltage at M17 and M18.
M13 and M15 are indeed cascodes even though their gate voltage is not constant. Their gate voltage will not vary much though. M13 and M15 provide a low impedance at their source so that the currents from M2 and M4 can flow into the string M12 - M15.
This cascode structure is similar to a &quot;folded cascode&quot;, see this lecture sheet 17 and onwards.