How are blocks accepted in bitcoin? These are steps to run the network quoted from the Bitcoin white paper (https://bitcoin.org/bitcoin.pdf):


New transactions are broadcast to all nodes. 
Each node collects new transactions into a block.  
Each node works on finding a difficult proof-of-work for its block.
When a node finds a proof-of-work, it broadcasts the block to all nodes. 
Nodes accept the block only if all transactions in it are valid and not already spent. 
Nodes express their acceptance of the block by working on creating the
next block in the chain, using the hash of the accepted block as the
previous hash.


I am wondering weather there will be a scenario where the miners do not accept a valid block or accept a malicious block. Can anyone explain how steps 5 and 6 are executed?
I am wondering weather there will be a scenario where the miners do not accept a valid block or accept a malicious block


The only scenario in which this would happen is if someone on the network is running a malicious version of code with different consensus rules. In this event, anyone running that code will accept an invalid block (that is valid according to their incorrect rules), causing a fork in the chain.

However, everyone on the network using valid consensus rules would deem each block of the forked chain as invalid, and continue extending the real chain as expected.