A man has been freed from a bog by mountain rescue teams after walking on the moors.