Let $\{ e_1, e_2 \}$ denote the basis vectors with respect to which these matrices are written.
Try to show that, if we define a new basis, $\{ f_1 = a e_1, f_2 = e_2\}$, then in this new basis, the matrix for $A$ is
$$ A = \left( \begin{array}{cc} \lambda & 1 \\ 0 & \lambda \end{array}\right).$$
Can you find another basis in which the matrix for $B$ takes the form
$$ B = \left( \begin{array}{cc} \lambda & 1 \\ 0 & \lambda \end{array}\right)?$$
If so, then you've succeeded in showing that $A$ and $B$ are similar!
Finally, for $\{ f_1 = a e_1, f_2 = e_2 \}$ to actually be a basis, we need $f_1$ and $f_2$ to be linearly independent, i.e. we need $a \neq 0$. Otherwise none of this will work!
So you need to use the fact that the minimum polynomial is $(x - \lambda)^2$ (as opposed to $x - \lambda$) to show that $a$ cannot be zero - but you appear to have already done that!
By the way, ANY two-by-two matrix with minimal polynomial $(x- \lambda)^2$ has Jordan canonical form $\left( \begin{array}{cc} \lambda & 1 \\ 0 & \lambda \end{array} \right)$.