DTFT of sawtooth wave through DTFT of rect signal
The discrete Fourier transform (DFT) coefficients of a sequence $x[n]$ of length $N$ is defined by

$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N}\tag{1}$$

and the inverse transform is

$$x[n]=\frac{1}{N}\sum_{k=0}^{N-1}X[k]e^{j2\pi nk/N}\tag{2}$$

The discrete-time Fourier transform (DTFT) of a sequence $x[n]$ of length $N$ is given by

$$X(e^{j\omega})=\sum_{n=0}^{N-1}x[n]e^{-jn\omega}\tag{3}$$

Plugging $(2)$ into $(3)$ gives

$$\begin{align}X(e^{j\omega})&amp;=\sum_{n=0}^{N-1}\frac{1}{N}\sum_{k=0}^{N-1}X[k]e^{-jn(\omega-2\pi k/N)}\\&amp;=\sum_{k=0}^{N-1}X[k]\frac{1}{N}\sum_{n=0}^{N-1}e^{-jn(\omega-2\pi k/N)}\tag{4}\end{align}$$

With the DTFT of a rectangular sequence $r[n]=1/N$ for $n\in [0,N-1]$ and zero otherwise

$$R(e^{j\omega})=\frac{1}{N}\sum_{n=0}^{N-1}e^{-jn\omega}=e^{-j(N-1)\omega/2}\frac{\sin(N\omega/2)}{N\sin(\omega/2)}\tag{5}$$

Eq. $(4)$ can be written as

$$\sum_{k=0}^{N-1}X[k]R\left(e^{j(\omega-2\pi k/N)}\right)\tag{6}$$

So $(6)$ is the correct version of the formula, and the DFT coefficients $X[k]$ are defined by $(1)$. If you use those formulas correctly it should work.