Does evolution go only in one direction?
No, it does not. There is no such thing as a goal of evolution at making things fly or at making things intelligent or whatever. There is no intrinsic directionality.
In short the reasons are 1) Evolution is much more than just natural selection 2) natural selection does not systematically select for a specific trait. Some traits are advantageous under some ocnditions, some other traits are advantageous under other conditions.
I won't talk more about the mechanisms of evolution here as it would take a whole book. Instead I will recommend a source of information for you to further your knowledge.
Source of information
As your question is very introductory and shows misunderstanding, you might want to have a look at an intro course to evolutionary biology such as for example Evo101 by UC Berkeley.
Note that this term is rarely used in the scientific literature (actually I think I have never encountered it in the scientific literature). From wikipedia:
In modern biology the term [devolution] is meaningless: evolutionary science deals with selection or adaptation that results in populations of organisms genetically different from their ancestral forms, where evolution has no intrinsic directionality. The discipline makes no general distinction between changes leading to populations of forms less complex or more complex than their ancestors, and in such terms the concept of a primitive species cannot be defined.
The question is a bit unclear
There is a slight issue with the question as it is not that easy to categorize all animals as living strictly in the water, on land or in the sky. Note that almost no living things live strictly in the sky without ever touching the ground. Here are a few examples of limit cases
- dragonflies (larvea live in the water, adult fly)
- flying squirrels
- Most ducks (spend much time on water but nest on land)
As a consequence the question is very undefined
Examples of potential interest to you
The question is undefined but here are a few examples of cases anyway that will interest you. For simplicity, I will reduce my list to animals only and will not consider similar cases in procaryotes, and non-animal eukaryotes such as plants and fungi.
Whose ancestors were terrestrial
- Cetacea (blue whale, orca, dolphins, ...)
- Sirenia (dugong and manatees)
- Pinnipeds (sea lions, sea leopards, ...)
- Marine iguana (and other swimming lizards)
Whose ancestors were flying
- ratites (Ostrich, emu, kiwi, ...)
- Many birds are able to stay for relatively long period under water when hunting for fish.
- Ants and other non-flying hymenopterans.
- Ground beetles and other non-flying beetles
- water beetle
Again, categorization is not that easy. I just want to highlight the water beetle as example where the ancestor was marine, then terrestrial, then flying, then non-flying and finally living in the water again.
How many times did terrestrial life emerge from the ocean?