In general, the output length of an FIR filter is given by (N+M-1) samples, where N stands for signal length and M stands for the number of filter coefficients. Can the same formulae be applied for IIR Filters? Let's say I have 4 input samples, 3 feed-forward coefficients, and 2 feedback coefficients. Then can I tell that my output length is 4+(3+2)-1? It is also known that the impulse response of an IIR Filter is not of finite duration. Does this thing affect the output length of an IIR filter, in any way?
To answer your last question, the impulse response having infinite length affects the output length in every possible way. In general, the output sequence of an IIR filter has an infinite length, even for a finite length input sequence. Of course, for stable filters and finite-length input sequences, the magnitude of the output samples decreases, and the output values become virtually zero after a while.
There are, however, specific input sequences that result in cancellations in the output, and, consequently, the corresponding output sequences have only a finite number of non-zero elements. A simple example is the first-order system
You can verify yourself that for the specific input sequence $x[n]=\delta[n]-a\delta[n-1]$, the output sequence is finite and simply equals $y[n]=\delta[n]$. However, note that the use of finite precision arithmetic in an actual implementation may still result in non-zero output samples, even in cases when ideally the output samples should cancel.