Your charger also needs to consider balance between the cells , constant current then constant voltage phases , then knowing when to stop charging .
Measuring battery temperature and also separate protection for under and over voltage .
Not too easy , study the battery chemistry and how to charge and maintain the batteries first !!
For a Li-ion charger, you want a sort of constant-current, constant-voltage supply (plus temperature measurement, timers, and maybe balancing circuitry. Although perhaps some of that is in other parts of your battery system.)
I think most Buck Converter chips are designed for one or the other (CV for most of them, CC for LED drivers.) Or, there are dedicated battery-charging ICs. (heh - Deja Vu - for my Senior design project I had planned on using an R/2R ladder and a comparator to implement an ADC, and my advisor advised "just buy an ADC chip.")