Artificial intelligent assistant

A problem about mollification The problem is : Given $M > 0$ a constant, show that exists $\phi \in C^{\infty}(R)$ with the following properties: i) $\phi(x) = x , \forall x \in [-M,M] $ ii) $ 0 \leq\varphi^{'}(x) \leq 1, \forall \ x $ This question arises form my question in the link In the previous link the user 79635 says : let $M$ be a constant , mollifing the function $f(x) = \min ( \max (x, M+1), -M-1 )$ , you obtain a function $\phi$ with the properties said above. I am trying to do the mollifcation, but i am not getting anywhere. Someone can give me a hand ? Thanks in advance.

Fix some $\epsilon>0$ and define for $x\in\mathbb{R}$: $h_1(x)=x$, $h_2(x)=M+\epsilon$ and $h_3(x)=-M-\epsilon$. Let $U_1=(-\epsilon-M,M+\epsilon)$, $U_2=(M,\infty)$ and $U_3=(-\infty,-M)$.

Let $\\{\phi_i,U_i\\}_{i=1}^3$ be a partition of unit associated with $U_i$, i.e.

I - $\phi_i\in C^{\infty}(\mathbb{R})$,

II - $\operatorname{spt}\phi_i\subset U_i$ and $\sum_{i=1}^3\phi_i=1$

Define for $x\in\mathbb{R}$ $$h(x)=\phi_1h_1+\phi_2h_2+\phi_3h_3$$

Note that $h$ is the desired function.

Remark: To make things more clear, note that it is possible to choose $\phi_i$ in such a way that $\phi_1$ and $\phi_3$ are strictly decreasing in $(M,M+\epsilon)$ and $(-\epsilon-M,-M)$ respectively and $\phi_1$ and $\phi_2$ are strictly increasing in $(-\epsilon-M,-M)$ and $(M,M+\epsilon)$ respectively.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy f47c53df4964e86d3833d79eb1ab7d16