GPIO input state with undefined voltage
You're trying to test a couple of things at once, you should first isolate the systems.

Output

First remove R68, and the unnecessary complicated pull-up - just connect a 10k resistor from the output to 3.3 volt, and check the levels manually. If this does not work as expected, there's no need to test the code.

Input

Keep R68 off the board. Measure the voltage on B. Connect B to GND through a 10k resistor, measure the voltage on B again. Break the connection and connect B to 3.3 volt through a 10k resistor, measure the voltage on B a third time.

If the voltage stays close to 0 or close to 3.3 volt at all times, it's configured as an output. If it changes between 0 and 3.3 volts when you change the resistor target, it is at least not driving the pin.

Fix

After you know where the problem is you can try to write the shortest program you can possibly do that will set up the pin and read its state. The process of writing this minimal example usually helps you find the problem.