1997 Pontiac grand prix

1997-pontiac-grand-prix
Lately while driving my headlights would dim/Pulse while braking or accelerating I bought a new battery today and installed it and it is continuing to do the same thing.