What is the reason behind that option writer still makes money when the premium increases though nifty or bank nifty does not cross the strike price, is it not unfair?

Option seller’s payoff is limited to premium received on selling an option and on the other hand his risk is unlimited. So its not at all unfair. Infact his gains are limited only to premium received on Selling an option unlike an option buyer whose gains are unlimited if his contract turns wildly In the Money

The fact that he is taking unlimited risk for a limited profit and while paying a very high margin giving a lower ROI makes it all fair i guess !

I think its completely fair. Why do you say so? The amount of money he pools to write options and the risk he takes justfies it.
If you feel envy about it, start writing options from tomorrow.