I want to implement an Z transform Equation in C (with saturation limits)
You said

if output is greater than 4 the output is 4 and if output is less than -2 then output should give -2

Just convert that sentence into code!
This method assumes that you are implementing
Y(i) = 0.05001U(i) - 0.04999U(i-1) + Y(i-1) directly in the code as such,
and not in some other form like Direct-II form etc.
Just follow the code that implements the above line by these lines.
if (Y(i) &gt; +4) then Y(i) = 4;
if (Y(i) &lt; -2) then Y(i) = -2;