You were really close with your original expression. You really just needed move your setText() call down from line 3 to the end of the expression, and use it to show reveal instead of parentText.
I cleaned up the code a little bit — using meaningful variable names is good practice to help future you understand what past you wrote — and I rewrote the blink feature so the cursor stays steady while you’re typing and only blinks when you’re not.
I’m here to teach, so please ask any questions you may have and I’ll do my best to answer.
// get the parent text and style to follow
var parentText = comp("MASTERCOMP").layer("MASTERTEXT")(2)(1);
var parentStyle = comp("MASTERCOMP").layer("MASTERTEXT")(2)(1).style;
var textLength = parentText.length;
var cursorCharacter = ["|","_","—","<",">","«","»","^"];
// get animation progress and cursor selector values from their respective Effects
var animationProgress = effect("Animation")(1);
var cursorCharacterIndex = effect("Cursor Shape")(1).value-1;
// create a blinking cursor. It should be steady as long we're typing, then blink when we're not
var textBlinkDuration = 1; // how long does a full text blink take?
var textBlinkOffTime = 0.5; // how much of a text blink is OFF (versus ON)
var currentlyTyping = animationProgress.speed > 0 ? 1 : 0;
var cursorOnOrOff = currentlyTyping == 1
? 1
: time % textBlinkDuration > textBlinkOffTime;
// cut the text down according to the Animation slider from 0 to 100%
var revealText = parentText.slice(0, textLength*linear(animationProgress,0,100,0,1));
// add the cursor to the revealed text if it should be on right now
if(cursorOnOrOff != 0){
revealText += cursorCharacter[cursorCharacterIndex];
}
// reveal the processed text
parentStyle.setText( revealText )