$\newcommand{\Zobr}[3]{{#1}\colon{#2}\to{#3}}\newcommand{\R}{\mathbb R}\newcommand{\intrv}[2]{[{#1},{#2}]}$ Lemma. Let $\Zobr{f,g}{\intrv01}{\R}$ be functions such that $f(0)=g(0)=0$ and the function $af(x)+bg(x)$ is monotone for any $a,b\in R$. Then $f=0$ or $g=cf$ for some constant $c\in\R$.
Proof. Let $f\ne 0$. Let us denote the space consisting of all linear combinations of $f$ and $g$ by $V$. We assume that all functions in $V$ are monotone.
W.l.o.g we can assume that $f$ is non-decreasing. (Otherwise we can use the same proof for $-f$.)
Let us take an $x_0>0$ such that $f(x_0)>0$.
Put \begin{align*} c&:=\frac{g(x_0)}{f(x_0)}\\ h(x)&:=g(x)-cf(x) \end{align*} We have $h(0)=h(x_0)=0$, which implies $h(t)=0$ for every $t\in\intrv0{x_0}$. (Since $h$ is monotone.)
a) If $h=0$ then $g=cf$.
b) Suppose that $h\ne 0$. Then there exists a point $y_0$ such that $h(y_0)\ne 0$. We know that $y_0\notin\intrv0{x_0}$
This implies $0. We have \begin{align*} 0&=f(0)$h(y_0)>0$. (Otherwise we can work with $-h$.)
b.1) Suppose that $f(x_0)=f(y_0)$ and define $h_1=f-h$. Clearly $h_1\in V$, but $0h_1(y_1)=f(x_0)-h(y_0),$ so $h_1$ is not monotone.
b.2) Now suppose that $f(x_0).
In this case we define $h_1:=f-2h\frac{f(y_0)-f(x_0)}{h(y_0)}.$ Clearly $h_1\in V$. We have $h_1(0)=0 h_1(y_0)=f(y_0)-2[f(y_0)-f(x_0)]=f(x_0)-[f(y_0)-f(x_0)].$ So the function $h_1$ is not monotone. $\hspace{2cm}\square$
The basic idea of the proof of this lemma is that if we have function which look similarly to the functions in the following picture, we can find a linear combination, which is not monotone.

Corollary. If $\Zobr{f,g}{\intrv01}{\R}$ are functions such that the function $af+bg$ is monotone for any $a,b\in\R$, then $f(x)=c$ for some constant $c\in\R$ or $g(x)=cf(x)+d$ for some constants $c,d\in\R$.
Proof. We apply the above lemma to the functions $f_1(x)=f(x)-f(0)$ and $g_1(x)=g(x)-g(0)$. $\hspace{2cm}\square$
The claim of the exercise follows from this corollary. Indeed, suppose that $V$ is a subspace of $\R^{\intrv01}$ which contains only monotone functions. We can assume that $V$ contains all constant functions, since adding a constant function does not influence monotonicity. The corollary says that if we take two linearly independent functions $1,f\in V$, then all remanding functions in $V$ are linear combinations of $1$ and $f$.
Remark. The above proof can be adapted without much effort to functions from $\mathbb R$ to $\mathbb R$ (instead of $[0,1]\to\mathbb R$). We just need to add one more case $y_0<0 to our lemma. (It is sufficient to deal only with $x_0>0$, since the case $x_0<0$ is symmetric.)