Is intraday squareoff different if original trade was cnc?

Yesterday I did a trade in which I sold all of my shares of a company which I had bought long back, so they were in my demat to Buyer A…
Then I shorted the same amount of shares, selling to Buyer B, then bought shares from a Seller 1.

Then I proceeded to the 2nd round of shorting by selling to Buyer C & then buying from Seller 2, then finally I bought some shares again from Seller 3 (but after 3.20 pm) so that I had the same number of shares as I had at the beginning of the day.
So in the end, i basically did intraday, of course I had to pay higher STT.
Would my shares actually have gone into the pool during the trading hours or do they go out of my account only after end of trade? Since I had bought the same number of shares at the end of the day as I had sold, will there be any outflow of my shares to Buyer A, B or C and inflow from Seller 1, 2 or 3 or are share movements done via some kind of pool and since I had same number of shares at the end of the day as I had in the beginning, there would have been no actual deduction of shares from my account?
Could I have safely put stop loss today, knowing that I will have shares in my account and the risk of short delivery from someone due to which sometimes its not advised to do BTST?

As i understood you sold X shares with the thought that these are for delivery . same day (time do not matter ) you sold additional X shares and bought X of shares .
OK so now your first sale of X shares is delivery sale.
your second sale of X and purchase of X of same day will be intra day transaction .

Thanks for your reply. My question was not about the charges, but about the risk. I have reworded the question, so hopefully it is more clear. Can someone please clarify a bit more?