First, your value for k is incorrect. The work required to stretch the spring from rest to 42 cm is:
Then use this value of k to evaluate the work to stretch from 35 to 40 cm:
W = .
Remember rhat the deflections are always measured relative to the rest position of the spring.