Twelve years they had served
The events in verses 4-7 happened before verse 3. Your language may have a way of showing this.
they had served Kedorlaomer
"they had been under the control of Kedorlaomer"
they rebelled
"they refused to serve him" or "they stopped serving him"