Buck Converter design with NMos

I cannot see how these parts, including a Mega 2560, have anything to do with a buck converter.

OK, presumably you intend to measure the charge current and switch off the converter when it is low enough.

But you cannot use the Arduino to generate the PWM as you have to be able to control the PWM duty cycle with a feedback circuit in order to regulate the current.