I want to show affin line $\mathbb A_{R}^{1}$ is not homeomorphic to real line $\mathbb{R}$(the topology is euclidean topology).
I think the topology on $\mathbb A_{R}^{1}$ is just cofinite topology, so we should only to show that there are no continuous map $f$ from cofinite topology to $\mathbb{R}^n$. $f$ is not constant map, so we can say cofinite topology has two points which are separated by two disjoint open subsets.But this contradicts the trivial fact that the cofinite topology is irreducible.
Is my attempt right? Or are there any good other ways to show the title?
I think your approach works but assumes $k = \mathbb{R}$ and we can work with milder hypotheses.
In general, the closed sets of $k[X] = \mathbb{A}^1_k$ are the common roots $V(S)$ to a family polynomials $S \subset k[X]$. Any such set is finite, and any finite set $F \subset k$ is characterized as the roots of
$$ p_F := \prod_{f \in F}(X-f). $$
(We are using that we can reduce the constraints to a finite amount of polynomials, for example because $V(S) = V(\langle S \rangle)$ and since $k[X]$ is noetherian, the ideal generated by $S$ is finitely generated).
Hence $\mathbb{A}_k^1$ has the cofinite topology for any field $k$. In particular, it will never be homeomorphic to a space with closed sets of infinite cardinality (fixing such a closed set $C$ in a space $Y$ and a homeo $f : Y \to \mathbb{A}_k^1$ would produce an infinite closed set $f(C)$).
Finally, we know that $\mathbb{R}$ has many infinite closed sets, such as $[0,1]$, so it will never be homeomorphic to any space equipped with its cofinite topology.