I think there is an error in this example in fact. I know that the point cloud is not oriented in the same direction then the imu in the inertial frame of reference, but still the transformations here makes no sense.
Try running this example by removing insToLidarOffset to obtain
% The INS readings are provided with X pointing to the front, Y to the left
% and Z up. Translation below accounts for transformation into the lidar
% frame.
insToLidarOffset = [0 -0.79 -1.73]; % See DATAFORMAT.txt
Tnow = [-insData.Y(end), insData.X(end), insData.Z(end)].';
Tbef = [-insData.Y(1) , insData.X(1) , insData.Z(1)].';
and see that you actually get the exact same relative transformation at the end.