Euclidian action of $\phi^4$ thory is given by: \begin{equation} \int d^Dx L_E=\int d^Dx\left ( \frac{1}{2}(\partial_\mu \phi)^2 +\frac{m_0 ^2}{2}\phi^2+\frac{g_0}{4!} \phi^4\right), \end{equation} Now I want to write it in lattice field theory but I am not getting it in same form as given in notes , I am expected to get
\begin{equation} S_E[\phi]=\sum_x \left\{\phi(x)^2 +\lambda[\phi(x)^2-1]^2\right\}-\beta\sum_{<xy>}\phi(x)\phi(y) \end{equation}
where, $g_0=4!\frac{\lambda a^{D-4}}{\beta^2}$ and $m_0^2a^2=(1-2\lambda)\frac{2}{\beta} -2D$.
For transformation I am using: $\partial_\mu\phi(x)\rightarrow \frac{\phi(x+\hat\mu a)-\phi(x)}{a}$ and $\int d^D x\rightarrow a^D \sum_x $ , and $\phi^2 \rightarrow \frac{a^{D-2}}{\beta}\phi^2$ , and shifting lagrangian $L_E\rightarrow L_E+\lambda$