How to set up a LiPo battery to be able to charge and discharge from the same circuit
One thing you don't do is both charge and discharge a LiPo battery at the same time.

You need a special charge IC to manage the charging of the battery, and a circuit which monitors the incoming power.

When there is incoming power the power is split into two - one to charge the battery (which is isolated from the rest of the circuit) and one to run the target circuit.  When the incoming power is gone the battery is switched into the main circuit to power it.

The most common system uses a simple P-channel MOSFET to connect / disconnect the battery from the main circuit.