Using Templater to Retrive and Parse File Name

I am trying to use Templater to parse the template file name to use to apply to the name of the new file created by the template assigned to a directory through the template setting directory assignment.

I have tried assigning a yaml property and retrieving the yaml property but have discovered that the yaml is not available unto the file has been created. So as a work around I am trying to use the file name of the template to assign a new file name.

Can someone explain why this is not working? There is a parsing error that tI am not seeing:

<%*
// Use Templater to rename the file after running the dataview code

// Retrieve the project name from the YAML frontmatter, or set a default if it’s missing
// const projName = dv.current().PROJ_NAME || “PROJ_NAME YAML ERROR”;
// const projName = “ROBOT”

const fileName = tp.file.title;
const secondDashIndex = fileName.indexOf(" - “, fileName.indexOf(” - ") + 1); // Find second dash
const projName = fileName.substring(secondDashIndex + 3); // Extract everything after second dash

// Prompt the user to enter the date for the daily log in YYYY-MM-DD format
const userInputDate = await tp.system.prompt(“Enter the Daily Log Date (YYYY-MM-DD):”);

// Validate the input to ensure it matches the YYYY-MM-DD format
const isValidDate = /^\d{4}-\d{2}-\d{2}$/.test(userInputDate);

if (!isValidDate) {
// If the date is not valid, display an error message
tR += “Error: Invalid date format. Please enter the date in YYYY-MM-DD format.”;
} else {
// Define the new file name using the provided date
const fileName = ${projName} DAILY LOG ${userInputDate};

// Rename the current file with the new file name
await tp.file.rename(fileName); 

}
%>

Thanks in Advance
-Tim C.