Help setting up the redirect page after appt. confirmation

I visited the archives and found some similar questions regarding this topic which were able to get me as far as adding the necessary code to my functions.php file. I had a parse error, and fixed that. However, my issue is about what happens after I add the code to the functions.php; when

function app_redirect( $script ){?return
str_replace("window.location.href=app_location()", "'_blank' href=''", $script);
add_filter( 'app_footer_scripts', 'app_redirect' );

is placed just after the opening <?php tag as suggested, it makes the appointment selection part of the process not clickable. The appointment calendar displays available times in the appropriate colors, but nothing on the calendar is clickable, and the time slots do not appear (since clicks aren't registering). This makes it impossible to schedule an appointment.

When I removed the code listed above from the functions.php file, the functionality of the calendar, time slots, etc. was restored.
I'm sure it's simply a matter of my not knowing much about coding, and that there's a simple fix within those lines of code.

Thanks for your help.