(I assume you know how to use the cargo manager).
The sides of the cargo distributor are marked with colors, , just like the cargo manager. You can drag the different symbols from the bottom to the different colored rows to indicate the inventory in the cargo manager that the pipe system interacts with. For example, if you drag "Bottom Right" to the green row, the filter, pipe, etc. connected to the green side of the distributor will interact with the bottom right slot in the cargo manager.
To set up a cargo distributor that feeds back fuel to the cart, you need to use two sides: an input and an output. You can connect an outgoing filter to one side, and mark that side's color with "From cart." That will take whatever you are extracting out of the cart using the cargo manager (wood, saplings, maybe apples) and put it through the filter. For maximum efficiency, I recommend using some sort of electricity-powered furnace to smelt the logs into charcoal after leaving a chest or barrel for the logs you want to use (you can then use the excess charcoal as an excellent source of power). Then, pump charcoal back into the cargo distributor on another side, and mark that side as "To cart."
Hope this helps!