Your end stop switch should have 2 wires attached to common and NC or Normally Closed contacts at the switch itself.

Those 2 wires should connect to signal and gnd in that end stop connector on the mainboard.

In Marlin under the configuration.h tab you will first select the end stops you are using..



Once you have selected the end stops you are using and just below that is where you need to make sure you have a pullup resistor tied to that end stop pin..



Then you just need to figure out what signal you are sending when you hit the endstop. And Marlin is helpful here in explaining whether or not your end stop logic needs to be inverted here..



And hopefully all will be good. But to check you should start homing your printer with the axis at mid travel and operate the endstop switch by hand so if it doesn't work you can shut it down before things start crashing into each other.