LTCG exemption

I had 5 Lakh LTCG by selling shares in fY23 for which I have paid tax.

This month I am buying a house. How can I claim a refund. Because LTCG is exempt in case you buy or build a residential property in next 2 years.

But I had no such plans last year so paid the taxes how can I claim refund