Your little program actually works, upto a point. Are you aware that you should press ‘;’ after each answer?
The problem is that once you get all the answers you will fall into infinite recursion. You can sidestep that by renaming the recursive predicate.
eats(A, B) :-eat(A, B).
eats(A, C) :-eat(A, B), eats(B, C).
write(X), write(' ate the '), write(Y), nl, fail.
write("That is all, folks!").
31 ~/tmp/prolog> swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 7.4.2)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For built-in help, use ?- help(Topic). or ?- apropos(Word).
lion ate the dog
lion ate the cat
lion ate the bird
lion ate the spider
lion ate the fly
That is all, folks!
Hope this helps a little. :-)