Before going and buying/adjusting your sights, have someone you know that shoots very well shoot the pistol. From what you described, it sounds (if you're a right handed shooter) that you are anticipating the shot. Lefties will send them down and to the right. A cheap way to find out if you are doing this is to buy yourself some dummy ammunition and load a couple into a magazine with live rounds, then shoot your pistol. See what your sight picture looks like when the gun goes "click" instead of "bang". I'd be willing to bet it's more of a shooting issue. The .40 is a snappy round that will develop bad habits very well for newer shooters, as well as experienced shots.
Also, what distance were you shooting at? if you're getting these types of groups at 20-25 yards, I'd say check out the sights. If you're at 5-10 yards, I'd look into your shooting fundamentals.
Oh, and for ammunition, most any .40 cal of reputable manufacture will work. I use a 9mm at work and we use the Gold Dot 124+p. Gold dots are good rounds, but a little more expensive due to the fact that they're bonded. If you most likely wouldn't have to shoot through glass, I'd go with the Federal HST (not hydra shok), Remington Golden Sabre, Winchester SXT, all in 165 gr. Don't get me wrong, Gold Dots are the bees knees in my opinion, but I'm really liking the Federal HST ammo as of late. Stay away from anything that starts with, "XXX", skull and crossbones, "Extreme" or "Terminator" in it's name. Too much hype.
Have fun with your new blaster. It's a great weapon. you might also want to look into an Advantage Arms .22 conversion for cheap practice. If you do have some bad habits developing, banging more .40s downrange will not only clean out your pocket, it will continue to reinforce bad habits. Shooting a .22 is the second best type of practice. The first being Dry firing your (EMPTY/STERILE) pistol.
I'll pass my soapbox off to the next person now...
Some of the best advice I have read on this site so far, I am no "expert", not ever carried a gun for a job or been in law or military, I have however been shooting "guns" for 30 odd years, and handguns for 20 years, I have shot hundereds of thousands of rounds through my IPSC guns, mainly an SVI or STI, but also alot through a G17, maybe only 15000 through the glocks ( three so far), all factory 115-130 gr ammo as I could not be bothered picking up those little 9mm cases.
The glock trigger takes some getting used to, placement of your finger in the trigger gaurd and on the trigger "shoe" will have a huge effect on where your rounds go. Most people with normal to large hands will put thier finger too far into the trigger gaurd and engage the trigger closer to the joint of the finger instead of half way along the pad. When this happens it will push the trigger to the left (for right handers) and each shot after will be the same as you cant reset your trigger finger position without releasing the trigger.
REMOVE ALL MAGS AND AMMO FROM PRACTICE AREA, DONT EVEN HAVE A MAG OR BOX OF AMMO IN THE ROOM, THIS IS NOT NEGOTIABLE, PEOPLE GET SHOT WHEN AMMO IS IN A DRY FIRE AREA.Do some dry fire drills, from the holster to start with,.
Set up a target on a wall, across the room, dont make it too big, about the size of a the bottom of a coke can, make it dark if the wall is light.
Now this will involve a lot of dry fires, it wont hurt your Glock, have dry fired many thousands of times without issue.
Cock and holster, draw, take site and dry fire. Now before you lower your arms, release the trigger, or change your grip, have a look at where the sights are pointing, now look at what part of your finger is touching the trigger.
It should be half way along the first pad of the finger, not the tip, and not in the joint.
Repeat several times, stop and check each time.
Now do the same drill but not from the holster, this time start gun in hand(s), have your finger in the correct spot on the trigger, raise, aim and dry fire, not look at the sights, see where they are, repeat this drill, over and over, you need to develop mucsle memory of the correct technique on how to grip the gun and engage the trigger.
Cock, holster, draw, dry fire and check, do it so many times that it become automatic to get your finger in the right spot, when you tired, stop, dont practice bad habits.
Go back to it the next day and see how you go, it should not take too long for you to get it right.
Repat, repeat, repeat.
Once you can draw gun, get a proper grip and engage the target, dry fire and have the sights spot, buy some cheap ammo, or a 22rf converion, go to the range, set up a target at 8-10 years, now do it, slowly, with ammo, don't empty the mag each draw, one shot is enough, if site picture is good after the shot, fire a second to see how it goes.
The middle of the target will soon disapear, dont bother patching it out, just patch the wild ones, as you do this more and more, you will be keeping them all inside a 1.5-2" circle.
Once you are doing this, every time, move back, if you are getting too many wild ones, stop and look at what has changed, is your grip good and finger bad, are you rushing, or just not looking at the sights? Fix the issue and move on.
Being able to keep your shots inside a neat little group at 25 yards is a really good confidence booster, you know when you fire, where your shot is going. This is important.
Now set up targets at different ranges, and at different heights etc, do the same drills, move between fire positions, remembering to remove the finger from the trigger until just before you shoot, after you have shot a few thousand round with the above in mind, your mag changes will be instinct, your draw will be the same every time, grip also the same, every time. You will hit what you aim at, which is the whole idea of shooting.
As I have said, I am not an expert, I shoot IPSC, have for 15 years, I shoot at Master grade and have finished inside the top 8 at several National Championships, I have won state titles and dozen of regional matches, I know what I know from being tought by guys who can out shoot me most days. Take from the above what you will. My shooting was all for competition and fun.
Spend money on ammo and range time, but dont waste it by shooting at dirt clods and cans, you carry a G23 for self defence, what I would consider the most important competition of all.
Best of luck, enjoy and stay safe.