Patience, Patience, Patience............
Golf is not an easy game.
Most beginners usually want to see their shots go at the intended target.
This leads to looking up quickly. This is the probably the difference of what you are experiencing at the range and on the course.
At the range, practice an abundance of shots with each club, use your imagination.
On the course, practice when there is no other golfers behind you. (late in the day is a great time)
Practice on the course is an opportunity to hit a few bad shots, over.
It will not matter if you still hit bad shots, but if you hit good shots it will boost your confidence.
If and when you do play on course, do not let bad shots frustrate you.
The good shots will come with practice, guidance and lessons.