that is correct, we can use setAttribute method as shown in below example
// Input: user (AD:User object from the AD plugin)
var username = user.sAMAccountName; // Get the username
var profilePath = "\\\\demo\\profiles\\" + username; // Construct the profile path
System.log("Setting profile path to: " + profilePath);
user.setAttribute("profilePath", profilePath); // Set the AD attribute
user.update(); // Save changes to AD