Ability ids are integers
you can store them with Jass like
call StoreInt(<gamecache>,"key",'A000') for example
I guess you are using some sort of ability purshing system
so you need to store ability ids in variables
Whenever Unit buys ability
Set NumOfAbilities[Player Number] = NumOfAbilities[Player Number] +1
Custom script: set udg_Abilities[ConvertedPlayerNumber(GetOwningPlayer(<learning unit>))] = <id of learned ability>
when storing
For Each A integer from 1 to NumOfAbilities[Player Number of storing player]
Custom script: call StoreInt(gamecache,"keyname"+I2S(bj_forloopAindex),set udg_Abilities[ConvertedPlayerNumber(GetOwningPlayer(<learning unit>))])
anyway something like this