For what it's worth, note that you don't need to 'start the list', as nil is equivalent to an empty list in AutoLISP, and an unbound symbol will similarly evaluate to nil and hence an empty list.
As such, your code could be written as:
(defun c:test1 ( / mylist mynewlist )
(setq mylist '(0 1 2 3 4 5))
(foreach x mylist
(setq mynewlist (append mynewlist (list x)))
(print x)
)
(setq mynewlist (cdr mynewlist))
)
Testing the above yields the following at the Visual LISP IDE console:
_$ (c:test1)
0
1
2
3
4
5 (1 2 3 4 5)
Be sure to declare your local variables within the defun expression, otherwise the variables will be considered global and will retain their values within the document namespace (i.e. within the scope of the active drawing) - observe:
(defun c:test2 ( ) ;; No local variables - all variables are global!
(setq mylist '(0 1 2 3 4 5))
(foreach x mylist
(setq mynewlist (append mynewlist (list x)))
(print x)
)
(setq mynewlist (cdr mynewlist))
)
_$ (c:test2)
0
1
2
3
4
5 (1 2 3 4 5)
_$ (c:test2)
0
1
2
3
4
5 (2 3 4 5 0 1 2 3 4 5)
Notice how the list contents are repeated for every evaluation (and incorrect values removed by the cdr expression) because the mynewlist variable has retained its value after the function has completed evaluation? For more information on this concept, you may wish to refer to my Localising Variables tutorial.
I would also suggest the use of the AutoLISP cons function, as this is both cleaner and more efficient than the append function:
(defun c:test3 ( / mylist mynewlist )
(setq mylist '(0 1 2 3 4 5))
(foreach x mylist
(setq mynewlist (cons x mynewlist))
(print x)
)
(setq mynewlist (cdr (reverse mynewlist)))
)
_$ (c:test3)
0
1
2
3
4
5 (1 2 3 4 5)
In this case, since elements are 'pushed' onto the front of the list, the list is therefore constructed in reverse and the reverse function is used at the end of the function.