How would I increase the slowness effect given to a player every time they died?

Hello! This is my first datapack and currently i've made it so that on load this scoreboard command is run: scoreboard objectives add death deathCount and in my death function i have the following commands:

effect give @p minecraft:slowness infinite 1 true```
I have no idea where to go from here, my thinking was that if i could detect when the player died (which i have done via an advancement) and somehow detect the increased deathcount i could apply an increased slowness level.

is there a way to do a loop when the deathCount increases with commands?
Continue to help post