How the bitcoin network solves the double-spending problem by adding all the transactions that happened at the same time into one block According to my research, I understand if person A sends 2 BTC to person B and at the same time person A sends the same input to himself before the input is considered as spent. So, now there will be a different route for each transaction while broadcasting (where nodes will check transaction chain to verify the history of ownership by the previous transactions) in the bitcoin network and might be the wrong one got confirmed first. Obviously, the second one will be rejected and the network will give contradiction while consensus. So, according to my understanding bitcoin network solve this issue by adding all the transactions that happened at the same time into one block of the block-chain. Please let me know if I am wrong. I will appreciate your guidance. Thanks
So, My question is: How the bitcoin network solves this issue by adding all the transactions that happened at the same time into one block?
according to my understanding bitcoin network solve this issue by adding all the transactions that happened at the same time into one block of the block-chain.

This is not true.
Same time
You should remember that the Bitcoin network doesn't really try to keep accurate time. Blocks are not always in sequence by timestamp in the block. So long as they do not seem to be more than about 2 hours wrong, it will be accepted. So the notion of &quot;happened at the same time&quot; is ill-defined.
There is a limit to the size of a block, so it would often not be possible anyway.
Choosing transactions
Miners choose transactions for incorporation into a block. They choose transactions from a pool of unconfirmed transactions they have received. This pool is called the mempool.
Which transactions miners choose is entirely up to them. They could choose on the basis of highest fees that the transactions will pay to the miner. They might choose on any other basis that their operator feels makes sense for them.
What might be causing some confusion is that if an unconfirmed transaction B spends the output of another unconfirmed transaction A, I believe miners will find it necessary to include A in any block that contains B.
Double spending
A miner cannot include in one block two transactions that spend the same input. Such a block would be rejected by everyone else.
If a miner includes in a block a transaction that spends an output already spent by a transaction in an earlier block, the later block will be rejected by other nodes. So miners don't do this if they can avoid it.