A consistent scalar-tensor cosmology for inflation, dark energy and the Hubble parameter