The point of the question is that gravitationally bound objects, (the atoms in the planet earth, or the cloud of gas that collapses to form a star, or the stars in a galaxy) behave as if the net force of gravity is coming from the center of mass.
Any galaxy, even a hypothetical galaxy with uniform density, will have a center of mass, and there will be an attraction to it. The condition of uniform density will be unstable.
If you are a star in the galaxy, the stuff farther out pulls you away from the centre, the stuff farther in, pulls you towards the centre. Simple physics.
And what pulls you away if you are the outer star? Are you proposing an infinite galaxy?