How to plot in % the difference b/w output and input signal in AC analysis [LTspice]
write 100*(mag(v(out))/mag(v(in)))-1). 

If you have the input voltage =1 in the ac analysis, write 100*(mag(v(out))-1)

Your own equation wipes off the imagininary part. That can be a substantial error.