Let $f:\mathbb{R}^n\longrightarrow\mathbb{R}^n$ be a continuous function and $n\geq 2$ such that the image of every line of the form $$x+tv $$ where $x\in \mathbb{R}^n$, $t\in \mathbb{R}$, $v\in B(0,1)$ is still a line.
Can we say that $f$ is an affine map?
If you are willing to assume that $f$ is a bijection then you can apply the fundamental theorem of projective geometry to conclude that what you want is true. Here is a wikipedia link, and here is a mathoverflow link.
The way that theorem is applied is to first conclude that $f$ is a line-preserving bijection of $\mathbb RP^n = \mathbb R^n \cup \{\infty\}$. The fundamental theorem then lets you conclude that $f$ is projective transformation. Since $f$ fixes infinity, it follows that $f$ is an affine map.