Deal aims to form a national unity government and end infighting between forces loyal to the two competing parliaments.