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?