In the line of duty means that someone did something, usually exceptional or different, as part of their work- police can get killed in the line of duty, when they are trying to help.