What is the reason behind multiple cnc order not showing the separate order if sold from holding?

Suppose If I have some share in the holding and I sold at some price and got profit. I thought of buying the same share once I saw moving upwards again.

If buy again it will take a position once and avg the price? what not its take as a fresh cnc order. Let it be there whatever profit and loss come from. Where first trade which got closed earlier should be untouched. It’s very confusing and for beginners and even for some experience as well.