For-loops were implemented in version 4.6 of gnuplot, and in versions previously there was nothing like loops. So you need to update your version!
Edit: As Christophe mentioned, the first for functionality was introduced in 4.4. However, 4.2 is too old.
source share