how to change the stiffness of a spring element during a step

Hi, I am using a SPRING2 element in Abaqus/Standard and I need to update the stiffness at each increment of a step. I hope I could do this by means of a subroutine, since the stiffness value to be used in an increment (i) depends on some output variables of the increment (i-1). Do you have any hints on how to do so?

Abaqus ​​​​​​​