This is a basic question of finite geometry / finite set theory, but I can't find a duplicate to this question, so I'll answer it here. What you have is a hypergraph: some sets $A_1, \dots, A_n$. It is uniform, because all $A_i$ have $k$ elements. It is intersecting, because for every pair $i,j$, we have $A_i \cap A_j \neq \emptyset$. It is linear, because for every pair $i,j$, we have $|A_i \cap A_j| \leq 1$. An example of a uniform, linear, intersecting hypergraph is a trivial one, namely where all the $A_i$ intersect in the same element but are otherwise disjoint. The point of the question is to show that all other uniform, linear, intersecting hypergraph have $n \leq k^2-k+1$.
Let $A = A_1 \cup \cdots \cup A_n$ be the ground set, and assume that this hypergraph is not trivial. For $v \in A$, let $d(v)$ be the number of $A_i$ which contain $v$. Since the hypergraph is not trivial, for every $v \in A$, there exists $A_i$ such that $v \not\in A_i$. The $d(v)$ $A_j$ containing $v$ are disjoint aside from $v$, but they each must intersect $A_i$. Since $|A_i| = k$, we have $d(v) \leq k$. Now we do some double counting. Observe that
$$ kn = \sum_{i=1}^n |A_i| = \sum_{v \in A} d(v) ,$$
so the sum of the $d(v)$ is fixed. Under this condition, we have that
$$ \binom{n}{2} = \sum_{\{i,j\}, i \neq j} |A_i \cap A_j| = \sum_{v \in A} \binom{d(v)}{2} $$
is maximized when as many $d(v)$ achieve their maximum value of $k$ under the constant sum condition. Thus $\binom{n}{2} \leq n \binom{k}{2}$, which gives $n \leq k(k-1)+1$ as desired.