That will only work for a Z probe. It won't work for an endstop switch because the endstop circuit includes an LED and pullup resistor. You need either NPN output sensors, or you could use a small N-channel mosfet or NPN BJT and a few resistors to convert the PNP output to NPN output. (I am assuming you have identified them correctly as PNP, I haven't checked.)