can i measure output currant on an output pin

If you want to measure current through a mosfet that switches a 24volt load, then this diagram might help.
There is a low value current sense resistor in the source of the mosfet.
An analogue pin can measure the voltage across the sense resistor (= current).
Picture in post#27.
https://forum.arduino.cc/index.php?topic=352403.15
Leo..