You can graph the points $(0,2)$, $(1,0)$ and $(2,4)$, and then consider that we want a line passing between these points, and reaching the highest possible value at $x=10$. It's clear that the best such line will pass through the points $(1,0)$ and $(2,4)$, so you see that the $b\le 2$ bound does not really play a role in the optimal solution.
Considering this as a linear programming problem in the variables $a,b$, we have three contraints, which provide a triangular feasible region in the $ab$-plane. The object function will be optimized at a vertex, so we consider all three:
1. $b=2, a+b=0\implies (a,b)=(-2,2)\implies 10a+b=-18$
2. $b=2, 2a+b=4\implies (a,b)=(1,2) \implies 10a+b=12$
3. $a+b=0, 2a+b=4\implies (a,b)=(4,-4)\implies 10a+b=36$
As for what went wrong in your second solution.... it's true that $a\le 4$ and that $b\le 2$, and it is true that $10a+b\le 42$, however, we can't actually obtain equality there, because we can't have $a=4$ and $b=2$ at the same time. This would violate the condition that $2a+b\le 4$. Looking at that condition, if $b=2$, then $a\le 1$, while if $a=4$ then $b\le -4$.