Transmission grating couples and enhances the second harmonic of the electron beam to generate tunable high-power terahertz radiation