you need to use message split in mapping to create multiple messages, and in turn multiple files for every value change
for example,
message type for source and target
use SplitByValue on each value change as below
when execute this mapping the result will be as below,
your message type could be different based on your exact requirements, but as Raghuraman has already mentioned , with group and split by value you should be able to achieve this.