You should add the formula asap, then cool the bottles. The reason being that formula is not sterile, so it needs to be added to boiling, or very hot water to kill any bugs that may be in it. If you add the formula to cooled water then there is no point in steralising in the first place, as the milk won't be sterile anymore. Keeping the bottles in the fridge also helps keep bugs at bay as they will breed and multiply if the bottles are kept at room temperature.
You can read more on the department of health's website.