SGB and tax-free status upon trading

I have curious question…is it regulatory grey area.
For equity and bonds, I buy in zerodha and hold for say three months and sell it.

When I buy in zerodha, I buy the same shares in let’s say abc broker. I will keep it in for year’s. So two broker’s there won’t be FIFO right. And it’s legal. While zerodha I use for short term and other broker for long term.

Also my friend tried to close his HDFC securities when I referred zerodha. Hdfc were not transferring LIC shares to zerodha. So he sold the shares that day in HDFC and brought in zerodha same day. He has short term capital gains losses.

Now it’s legal right to offset short term capital gains profit with lic loses.