As the title my question is how they earn bitcoin by mining?
Is it only from the block rewards or they also get btc for the validation of transactions?
Unlike back in the good old days around the likes of 2009, currently mining success is a direct measure of how much hashrate you generate that means the more hash rate you generate the higher your chances of getting the block reward which is basically what every miner wants to get in addition to how much transactions they can confirm.
In addition to what others have said, think of the block reward as the jackpot for mining and the fees attached to confirmed transactions a compensation for your Hashrate.