What happen if some blocks are added simultaneously with same previous hash
A fork happens. If A and B are competing for the next block, they probably share transactions. So you cannot simply append A to B.

They're both valid blocks, nodes hold both of them until they hear about a new block that was built on top of either A or B. Let's say a node hears a new block C was built on top of B, that node will then disregard A because it isn't a part of the longest/heaviest chain. The transactions in A that are not in B are returned to the mempool to be mined in a new block.

The network reaches consensus by trusting the longest chain. This is why it is suggested to wait 6 confirmations for a transaction. This gives extremely high confidence that the network has reached consensus on your transaction and there is a very low probability that your transaction will be apart of a reorganization of the blockchain.