As it is in AE, there are a couple of ways to do this. I’d look at using the Linear Interpolation Expression Method. So, look into that to see if you’re able to to achieve what you want.
I’m actually having a hard time looking at your code cos everything’s so tiny.
Stuff like this looks easy but they involve combining different mid to difficult aspects on Expressions and can get complicated once you add more Text Layers into the mix. I’d put this at Intermediate Level AE and not ideal for a newbie unless you have the patience to dig deep and far.
If you can post your code in your post, it will be more useful to other to see it as well as to edit it, to provide you with perhaps clearer guidance.