OK I think I finally understood what you want, and that is not possible.
Holding a key will bring up that character accents.
But you do not want to pick one you only want to have the pressed key repeat.
So to do that you need following command in Terminal to enable it.
defaults write -g ApplePressAndHoldEnabled -bool false
Since the keyboard is initialized during the boot cycle, you need to restart for it to take effect.
To set it back just use
True at the end instead of false.
Unfortunately that will disable the "Accents" pop up since those 2 functions are conflicting.
Writing a Script that switches the function for the press and hold is useless since you would need to restart anyway.