Buying/selling government bonds

My understanding is, when central bank buys gov bonds, it pays with domestic currency and hence increase domestic currency circulation in the country, which will depreciate the currency as supply has increased. So how does it sterilize the effect of hot money flowing out then?

Hot money flows out it is draining the local markets of liquidity, depriving the local financial markets of cash and pushing up rates.

The buying of the bonds trys to restore this (or at least some of) this lquidity.

The hot money may also (probably will) cause the local fx to depreciate. If the central bank does not want this they would need to sell foreign currency reserves and purchase more local currency. This is used to buy the bonds.

What was “foreign” money is circulation in the local economy has been replaced bu central bank money.

I’m kind of confused. As you stated, they would need to purchase domestic currency to appreciate the currency, but buying gov bonds (opposite of buying domestic currency) would increase domestic currency in the country right, leading to further depreciation?

Hot money HM goes

HM leaves commerical banks who are now short on cash and out up rates

HM sells local fx
Central bank buys foreign currency and own domestic currency

Central bank buy bonds from commerical banks
Commerical banks now have cash again.

Central bank did nothing. Ciurrency would spiral and local interst rates would go up.

Central bank sterlise this domestic lquidity issue of commerical bank by buying commerica banks bonds providing them with liquidity.