You missed it. That 52 test span is some 10 years. For the last 4 of those years he only took 40 wickets - which means he barely bowled. It's in that same period he had his best period with the bat.
The point with his batting is that he batted lower and was a plucky tailender who was hard to remove but who made little runs and then moved up some places and was generally a decent bat but who still didn't make a whole lot of runs but was still difficult to remove. Botham on the other hand was not a tailender-caliber ever and his runs per innings show how much more valuable he was to his side as a batsman.
I'll give you an example to illustrate my point, although not completely representative of the two players:
Batsman A bats at 5-6 and scores 100, 30, 20, 0 and 40. He ends up averaging 38.
Batsman B bats at 7-8 and scores 50*, 10*, 10*, 0 and 20. He ends up averaging 45.
The average is runs/dismissal so Batsman B's average is higher. In reality, Batsman A is the better batsman in most cases (apart from if the not-outs is rescuing a draw or something) as he actually scores more runs for his side. He also bats higher indicating his prowess with the bat. Imran also averages more than Miller - who batted at #5 for the Invincibles. It doesn't mean he was a better bat.
Using his average is misleading but only in the sense that people use averages to gauge players across the board. As I said, saying Imran averaged 50+ for the last 10 years of his career gives the impression that he was a rival for Richards, Border and Gavaskar with the bat...when he was actually only scoring ~37 runs per inning.