Scheme already has a function named append
, which takes multiple lists as arguments and returns the concatenation of all the lists. So you should name your function something else, like append-element
perhaps.
You can define your function by simply using the existing append
function to concatenate the list you want to append to with another list containing only the item you want to append like this:
(define (append-element x xs)
(append xs (list x)))