Dynamics of dinuclear system formation and itsdecay in heavy ion collisions