Another way to say "a hat is used for keeping your head warm" is "To keep your head warm you can wear a hat"