I Samuel 6:1-21, 7:1-2.
The ark was sent from the Philistines and arrived at Bethshemesh where 50,070 men were slain because the ark had been looked into. Then it was brought up to the house of Abinadab in the hill and abode in Kirjath-jearim for twenty years.
I Samuel 14:18
And Saul said unto Ahiah, Bring hither the ark of God. For the ark of God was at that time with the children of Israel.
The narrative affirms that the ark was not with the Philistines at this time but with the Israelites. So the twenty years had transpired and now Saul moved the ark.
II Samuel 6:2
And David arose and went with all the people that were with him from Baale of Judah to bring up from thence the ark of God ...
II Samuel 6:4
And they brought it out of the house of Abinadab which was at Gibeah.
The ark had been moved, after twenty years, by Saul, from Kirjath-jearim to Gibeah, but Abinadab went with it and was still the custodian of it.
Gibeah is of the tribe of Benjamin and is in the hills of Judaea, see I Samuel 13:16 and I Samuel 14:16, for example.
I notice in the margin of the Authorised Version that one of the AV translators seems to think the ark was in Kirjath-jearim until David called it from there. This translator has added marginal notes in an attempt to 'correct' the text. For example, making reference to the fact that Gibeah (which means 'height') means, he says, 'hill'.
The location of Baale of Judah is unclear. Robert Young says it may be another form of Baalah, there being three cities of that name to choose from, but the word itself means 'possessor', so the text may not be referring to a specific city but to the authorities within Judah. I am not clear on this matter, myself.
But there is no need to correct the text. The main issue is, historically, quite clear from the narrative.
Thus the ark was in Kirjath-jearim for a good deal of Saul's reign but it then abode in Gibeah, of Benjamin, closer to Jerusalem for a further time after which Saul was killed and, shortly thereafter, David was made king and moved the ark to the city of David, just beside Jerusalem.
EDIT : I note the comment below and appreciate the Chronicles texts there supplied by @user 21676. I hope that the user will supply an answer. For now, my answer stands as it is supplied but there does seem to be more of a difficulty than I was, at first, aware of.
If I am given evidence that this, my answer, is incorrect, I shall immediately delete it. I have no desire to make incorrect statements.