Missing endfunction error

I’m creating my first vim function and can’t get the definition right. I have this code in the file ‘myfunc’:

function! UnderlineSingle ()
  let myline = getline(line('.'))
  let myline = repeat('-', strlen(myline))
  append(line('.'), myline)
endfunction

yet when I try to source it with the command:

:source myfunc

I get this error message

E126: Missing :endfunction

After a bit of head-scratching, I found that the line with the append function was causing the problem and that I had to assign the result of the append function to a variable, like so:

let tmp = append...

Is there a way to just execute a function for its side-effect and ignore the return code or do I always have to do this kind of temporary assignment?

Answer: I just do:

call append...