You cannot create functions at the MATLAB command prompt: you have to write them into files.
If it is already in a file, then there is something before that in the file that has been interpreted as being a script instead of a function. The first non-comment line of the file needs to start with "function".