Find the transfer function of the difference between IIR and FIR filter I am using a filter following equations from papers.
It is basically the difference between exponential moving average and simple moving average.

$$L[n]=\frac{1}{\alpha_L}f[n]+\left(1-\frac{1}{\alpha_L}\right)L[n-1]$$

$$ S[n]=\frac{1}{\alpha_S}\sum_{k=0}^{\alpha_S}f[n-k]$$

$$ g[n]=S[n]-L[n]$$


$f[n]$ - original signal
$g[n]$ - filtered signal
$\alpha$ - window size


I can find their transfer function separately for $L$ and $S$, but I have no idea how to get transfer function of $g[n]$. Anyone please guide me, I would really appreciate it.
Because you are using a linear combination of the two filters, you can find the resulting transfer function by directly subtracting them from each other. If you want to do this, then you have to make sure that they have the same denominator, such that the total transfer function is one quotient of polynomials. If you do not know how to do this, you could check this example.