If it is slinging (not grouping) rounds at different yardage,,then something might be loose,,not broke in ,,or doesnt like what your feeding it.
Some rimfires,no matter 17 or 22 cal,,are very ammo picky.
If you cannot get 3 touching at 25 yards,,get differnt ammo ,,if everying is good and tight................X