When we do any work, it is our muscles who do the work. And heat is generated in the cells when we do work. As a result, our body temperature rises which is bad for health. So water from our body, along with salts and other particles come out of our body. When the is evaporated, it takes away heat from our body making it cool and lowering the body temperature. So sweating helps in cooling our body while doing work.