There is "intrinsic" accuracy...how close together the pistol will group shots (a simplified explanation, but close enough)...and "practical" accuracy...how well the pistol shoots for you.
A weapon can be extremely "accurate" in the intrinsic sense, but if it has crappy sights, a terrible trigger action, etc. it will not be capable of good performance in the hands of the shooter.
The guys who say rent/borrow before you buy are correct. Ditto for those who say to try the 3 1/2lb. connector and/or different sights. My guess is that you...like almost all of us...need to work more on trigger control.
Trigger control is, hands down, the MOST important fundamental for shooting a pistol well. MUCH more important than sight alignment. The Glock trigger action can be a little difficult to become accustomed to if this is your first one...not bad, just different.
For me, what works best with the Glock is to place a little more finger on the trigger and...for lack of a better word..."oooch" it off the sear, sort of like a double action revolver.
Remember, the bullet WILL go wherever the muzzle is pointed at the instant the bullet leaves the barrel...not where we had it pointed before we yanked the trigger through the last half of the pull. No slam on you, but it is amazing just how many shooters do this without realizing it.
There is also not one thing wrong with the Beretta you seem to like. Beretta builds one Hell of a good gun too.
If this was me, I'd keep the Glock and save to buy the Beretta later.