Wide Range Input DC DC Buck Convetrer Design
How do i ensure the output voltage stays constant for a varied input
voltage.

You use a method called feedback - the output voltage is compared against a stable reference voltage and, if it rises above the reference voltage the duty cycle of the buck converter is lowered. If it falls below the reference voltage, the duty cycle is increased. For this you will need a voltage reference and an error amplifier.
There are hundreds of books written about this and so, you might imagine, my answer is just giving the very bare essentials of what you need to do to regulate the output voltage.