You are correct - keeping the bike in the appropriate gear is important. Generally, you should have a preferred pedaling rpm, or _cadence_ that you try to keep constant. Change to lower gears on uphill gradients, higher gears on downhill gradients.
If you find yourself going downhill at a speed that even your highest gear makes you pedal too fast, feel free to coast. There is no rule that says you have to spin your legs madly to keep pedaling. Hybrid bikes tend to have fairly low gearing so coasting on faster downhill sections is normal.