A digital pot requires a digital input. You have an analog input signal and want an analog out.
Seems like all you need is an inverting op amp with a 12/5 = 2.4 gain and biased with a +12V output offset. Thus with 0V in, the op amp's output is 12V and with 5V in, the op amp's output is 0V.
Depending on the load you may need a buffer amp at the op amp output.
[Soapbox on]
See. Now that it's better understood what you need, we can come up with better solutions.
[Soapbox off]