Let:
$D \subset \mathbb{R}^2$
$f(x,y) : D \to \mathbb{R}$
$f(x,y)$ is continuous "along all lines parallel to $x$-axis" in $D$ (except possibly at the boundary).
$f(x,y)$ is continuous "along all lines parallel to $y$-axis" in $D$ (except possibly at the boundary).
Then will $f(x,y)$ be continuous in $D$ (except possibly at the boundary)?
The answer is no. Here is a simple counter-example. Let $D = \mathbb{R}^2$ and $f(x,y) : D \to \mathbb{R}$ define by $f(x,y) = \frac{2xy}{x^2+y^2}$ if $(x,y)\neq (0,0)$ and $f(0,0)=0$.
For the horizontal line $y=0$, $f(x,0)=0$ and it is continuous on that line. For any horizontal line $y=c\neq 0$, $f(x,c) = \frac{2cx}{x^2+c^2}$ and it is continuous on that line too.
In a similar way, we prove that $f$ is continuous on any vertical line.
However, $f$ is not continuous in the origin, because, for all $x \neq 0$, if we take $y=x$, we have $f(x,x)=1$. So, $ \lim_{x\to 0} (x,x) = (0,0)$, but
$$ \lim_{x\to 0} f(x,x) = 1 \neq 0= f(0,0)$$