Mit einer Koordinatenliste geht es:
% https://texwelt.de/wissen/fragen/21545/pgfplots-fehler-bei-listen-verwendung-illegal-parameter-number-in-definition
% Set Range of t-Values
\def\Range{-2,...,3}
% Create List of Coordinates
\newcommand{\List}{}% reserve name
\let\List=\empty% create list
\makeatletter
\foreach \t in \Range
{
\coordinate[label=below:$X-\t$] (X-\t) at ($(A)+\t*(B)$);
\pgfmathsetmacro\temp{"(X-\t)"}%
\ifx\empty\List{} \protected@xdef\List{\temp}%
\else \protected@xdef\List{\List \temp}%
\fi
}
\makeatother
[![alt text][1]][1]
\documentclass[margin=5mm, tikz]{standalone}
\usepackage{amsmath, amsfonts}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[]
\coordinate[label=$A$] (A) at (0,0,0);
\coordinate[label=$B$] (B) at (3,1,2);
% https://texwelt.de/wissen/fragen/21545/pgfplots-fehler-bei-listen-verwendung-illegal-parameter-number-in-definition
% Set Range of t-Values
\def\Range{-2,...,3}
% Create List of Coordinates
\newcommand{\List}{}% reserve name
\let\List=\empty% create list
\makeatletter
\foreach \t in \Range
{
\coordinate[label=below:$X-\t$] (X-\t) at ($(A)+\t*(B)$);
\pgfmathsetmacro\temp{"(X-\t)"}%
\ifx\empty\List{} \protected@xdef\List{\temp}%
\else \protected@xdef\List{\List \temp}%
\fi
}
\makeatother
\draw[red] plot[mark=*] coordinates{\List};
\end{tikzpicture}
\end{document}
[1]: https://texwelt.de/wissen/upfiles/55555555_408.png