How can I correct this python script to generate a surface from which I will paste another surface

As you can see in the script, what I am looking for is to create a surface where the first input allows me to assign a name for the new surface and after this add in surface editing “paste a surface that I select from my list”

There is no script to review?

Can you attached dyn file

import sys

try:
import clr
clr.AddReference(‘AeccDbMgd’)
clr.AddReference(‘AeccPressurePipesMgd’)
clr.AddReference(‘AeccRoadwayMgd’)
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.EditorInput import *

def create_surface(surface_name):
    with CivilApplication.StartDocument() as doc:
        with doc.LockDocument():
            civilDoc = CivilDocument.GetCivilDocument(doc.Database)
            with doc.Editor.StartUserInteraction(civilDoc):
                surf_table = civilDoc.Fsurfaces
                new_surface = surf_table.Add(surface_name)
                doc.Editor.WriteMessage("Surface created: {}".format(surface_name))
                return new_surface

def paste_surface(surface_to_paste, new_surface_name):
    result_surface = None
    with CivilApplication.StartDocument() as doc:
        with doc.LockDocument():
            editor = doc.Editor
            with doc.TransactionManager.StartTransaction() as transaction:
                try:
                    civilDoc = CivilDocument.GetCivilDocument(doc.Database)
                    surface_editor = civilDoc.Editor
                    surface_editor.Command("._EDIT")
                    surface_editor.Command("._PASTE")
                    surface_editor.Command("._END")
                    result_surface = civilDoc.GetSurfaceFromEditor()
                    if result_surface:
                        result_surface.Name = new_surface_name
                        doc.Editor.WriteMessage("Surface {} pasted and named successfully.".format(new_surface_name))
                    else:
                        doc.Editor.WriteMessage("Error while pasting and naming surface.")
                except Exception as e:
                    editor.WriteMessage("Error while pasting and naming surface: {}".format(str(e)))
                transaction.Commit()
    return result_surface

if __name__ == "__main__":
    surface_to_paste = IN[0]  # Superficie a pegar desde el nodo
    new_surface_name = IN[1]  # Nombre de la nueva superficie desde el nodo
    
    # Crear la superficie base y pegar la nueva superficie sobre ella
    result_surface = create_surface(new_surface_name)
    if result_surface:
        result_surface = paste_surface(surface_to_paste, new_surface_name)
    
    # Devolver la superficie resultante
    OUT = result_surface

except Exception as e:
OUT = str(e) # Enviar el mensaje de error al nodo para visualización

If you wrote this code , Use this method
TinSurface.PasteSurface Method