Inflationary magnetogenesis with reheating phase from higher curvature coupling