Comments made about pulling the trigger from the reset point will help. Also practicing at home on your grip and trigger control will help also. If you are shooting to the left and right 1 of 2 things are happening either at the same time or just one of them (they both will cause you to shoot left and right). The first is the grip, a slightly off grip will throw your sight picture off and cause you to shoot to the left or right. The 2nd is how much trigger finger is on the trigger. If you are wrapping too much finger around the trigger you will pull right when you shoot so your rounds will impact to the right. Shooting left is most likely a result of a bad grip. Putting those two issues together and you've got rounds going left and right.
Try focusing on getting your trigger finger on the trigger so that the pad of the first joint of your on your finger is on the trigger. Then focus on pulling the trigger from the point of reset straight back. That should help you keep from pulling the weapon to the right when you fire. It will take some practice, but you will get it.
I had to focus on this during range practice after going from the G20SF to the G23. The difference in grip impacts how much trigger finger I get on the trigger, and I was initially pulling right when I first started shooting my Gen 4 G23. Part of this is that I need to put the medium backstrap on so I will have a little longer reach to the trigger consequently giving me a more natural placement of my trigger finger on the trigger. You may want to experiment with backstraps to see what gives you the most natural grip/length of pull on the trigger in addition to the above.