hold last sensor value

I need it to stay on the last value it read.

That's exactly what it is doing. The last value that it read was a 0. You need to be a little clearer in your requirements.