Exile target creature or planeswalker. Surveil 1. (Look at the top card of your library. You may put that card into your graveyard.)
You perform the actions stated on a card in sequence. For some spells and abilities, you'll surveil last. For others, you'll surveil and then perform other actions.
If the target creature or planeswalker is an illegal target by the time Eat to Extinction tries to resolve, the spell won't resolve. You won't look at or move the top card of your library.
If you don't put the top card of your library into your graveyard, it remains on top of your library.