I'm an amateur and I'm buying a Nikon D5200. What exactly are filters used for? Do I need one for basic nature photography?
Simple answer: No, you don't need a UV filter. There is no particular reason to use one... film was quite sensitive to UV light, more so that the eye, so when shooting film a UV filter did something useful. Digital sensors are different in this respect, less sensitive to UV, so a UV filter is irrelevant. All you are doing with a UV filter is to stack up more glass, and more glass-air interfaces, in front of the sensor and this is a bad thing in and of itself.
An argument can be made (and frequently is) that it protects the front element of the lens, but this is far from self-evident. A lens-hood does much the same job of protection and is useful in that it shields the front element from light coming from outside the frame, which is a good thing.
The only use for a UV filter for digital cameras is to protect the lens, although there are mixed opinions about the usefulness of that. I do use a UV filter for extra protection, also to protect the lens from moisture. The lens then has to be cleaned less often, therefore it will accumulate scratches less fast. Now a few scratches won't affect image quality, but it is likely to cause a customer who you want to sell your lens to in the future, to offer less for it. Also, should you lose your lens cap the UV filter will still protect the lens, you can put a microfiber cloth over it fasten it by an elastic band until you get a chance to buy a new lens cap.
Note that as a lens protector, you should screw the UV filter off each time you use the camera and back on when you don't intend to take pictures for some time (the UV filter can negatively influence image quality, it can cause reflections particularly if you take pictures in the dark and there are some bright lights in the scene). You should use a rocket blower to blow off dust from the lens before screwing the UV filter back on. In cold conditions this is a good practice, if you are done taking pictures then on the ice cold camera, moisture will condense when you move into a warmer place. But the UV filter will now trap a bit of the bone dry air from outside, so no moisture will condense on the lens surface.