Sensex ends flat; Infosys falls, Mahindra gains