From your updated code, these two lines are important:
var pokemonchosen;
localStorage.setItem('pokemonchosen', pokemonchosen);
pokemonchosen
is
undefined
after that first line, but never gets a value. So the second highlighted line stores
undefined
into localStorage. And that's not very useful.
Somewhere in your code, you'll have to give
pokemonchosen
an actual value - before storing it in localStorage.