  In this paper, we consider the unit graph $G(\mathbb{Z}_{n})$, where
$n=p_{1}^{n_{1}} \text{ or } p_{1}^{n_{1}}p_{2}^{n_{2}} \text{ or }
p_{1}^{n_{1}}p_{2}^{n_{2}}p_{3}^{n_{3}}$ and $p_{1}, p_{2}, p_{3}$ are distinct
primes. For any prime $q$, we construct $q$-ary linear codes from the incidence
matrix of the unit graph $G(\mathbb{Z}_{n})$ with their parameters. We also
prove that the dual of the constructed codes have minimum distance either 3 or
4. Lastly, we stated two conjectures on diameter of unit graph
$G(\mathbb{Z}_{n})$ and linear codes constructed from the incidence matrix of
the unit graph $G(\mathbb{Z}_{n})$ for any integer $n$.
