I hate the 'bad writing' argument. It did happen. Why Data acted that way is the question.
The episode is suppose to make you question what you would do if you had been in Data's place. If your kidnapper announced that he would kill others if you didn't do what he told you after already killing someone, what would you do?