Let $A$ and $B$ be $n\times n$ matrices. Let $x$ be a scalar variable and define $D(x):=det(A+Bx)$. It can be easily shown by induction on $n$ that $D(x)$ is a polynomial of degree at most $n$. The problem is to find an explicit polynomial if the matrices are as of the following form (with $a\neq b$):
$$A= \begin{pmatrix} \lambda_1 & a & a & \dots & a \\ b & \lambda_2 & a & \dots & a \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ b & b & b & \dots & \lambda_n \end{pmatrix}$$
$$B= \begin{pmatrix} 1 & 1 & 1 & \dots & 1 \\ 1 & 1 & 1 & \dots & 1 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & 1 & 1 & \dots & 1 \end{pmatrix}$$
I already spotted an inductive pattern not really that useful: I found some regularity by calculating the determinant on the first column: the first term is $(\lambda_1+x)*D_{n-1}$ and the other terms are summations of $(b+x)(a+x)*D_{n-2}$ where every $D$ is called on submatrices with different $\lambda$ but it doesnt't really help for finding an explicit formulation. It seems to me at most useful for proving an already found polynomial is the right one.
It is easy to see that $\deg D(x) \le 1$ regardless of $A$ and $B$ (since we can multiply the first row by $-1$ and add it to all the other rows and then expand along the first row). Thus $$D(x) = \alpha + \beta x$$ for some $\alpha, \beta$. Now it is easy to see that $\alpha = \det(A)$, and $\beta = \det(A+B)-det(A)$.
For this particular $A$, $B$, note that $$C_a := D(-a) = (\lambda_1-a) \dots (\lambda_n-a)$$ and $$C_b:= D(-b) = (\lambda_1-b) \dots (\lambda_n-b).$$ Since $a\ne b$, we have
$$D(x) = -\frac{C_b-C_a}{b-a} (x + a) + C_a.$$