Notation. Use cons in C++ functions, not :. The right-hand operand of : is required to be a list. Expression head(L) + 1 has type int.
Incorrect. L does not change in the loop. So if L is initially empty, the loop never stops. The value of expression s:(head(L)+1) is being ignored, so the loop body is a statement without any effect.