Calculating the gain and phase shift of a phase shifting circuit
I think that writing the loop equations would be easier.

The loop equations for first two loops:
$$I_1(Z+R) = V_{in}$$
$$- I_1R +I_2(Z+2R) -I_3R = 0$$

Where \$Z=\dfrac{1}{Cs}\$. From this:

$$I_2(Z+2R) -I_3R = V_{in}\frac{R}{R+Z}\tag1$$
The remaining two loop equations:
$$- I_2R +I_3(Z+2R) -I_4R = 0\tag2$$
$$- I_3R +I_4(Z+2R) = 0\tag3$$

Expressing in matrix form:

$$\left[\begin{array}{ccc}
 &amp;Z+2R &amp;-R &amp;0 \\
 &amp;-R &amp;Z+2R &amp;-R  \\
 &amp;0 &amp;-R &amp; Z+2R 
\end{array}\right] \left[\begin{array}{c}
I_2\\
I_3\\
I_4 
\end{array}\right] = \left[\begin{array}{c}
\frac{V_{in}R}{R+Z}\\
0\\
0 
\end{array}\right]$$

Now by Cramer's rule:
$$ I_4 = \frac{\left|\begin{array}{ccc}
 Z+2R &amp;-R &amp;\frac{V_{in}R}{R+Z} \\
 -R &amp;Z+2R &amp;0  \\
 0 &amp;-R &amp; 0 
\end{array}\right|}{\left|\begin{array}{ccc}
 Z+2R &amp;-R &amp;0 \\
 -R &amp;Z+2R &amp;-R  \\
 0 &amp;-R &amp;  Z+2R
\end{array}\right|}$$

$$V_{out} = I_4\times R$$

From this the transfer function can be calculated. Gain and phase shift can be calculated from transfer function. (substitute \$Z=\frac{1}{jwC}\$)