Capacitor voltage in buck converter and how it steps down voltage
It may be more useful to focus on the inductor:
First assume it's fairly large and the switching frequency is fast.
Now the current through the inductor will remain fairly close to constant and always in the same direction.
With the switch ON, the current will gradually increase, from:
$$V =L \frac{dI}{dt}$$ where $$V = V_s-V_{out}$$
Because \$L\$ is large, \$\frac{dI}{dt}\$ is fairly small.
With the switch OFF, \$V\$ becomes \$0 - V_{out}\$ (negative) or more strictly, \$-0.6-V_{out}\$, so  \$\frac{dI}{dt}\$ is negative, and the current gradually reduces.
And that's pretty much it. (for a buck operating in CCM, Continuous Current Mode)
Oh - the capacitor - it just helps Vout remain close to constant, despite the variation in incoming current.
(Switch OFF for too long and the curent eventually falls to \$0\$ : the maths for Discontinous Current Mode, DCM, are different.)