Function to get PVI from a specific station range

i got a dynamo script for finding PVI as specific chainage. its not working.
anyone can help

# Import necessary libraries
import clr
import Autodesk.Civil.ApplicationServices as CivilApp
import Autodesk.Civil.DatabaseServices as CivilDb
import Autodesk.AutoCAD.ApplicationServices as AcadApp
import Autodesk.AutoCAD.Runtime as ACRuntime

# Load Civil 3D and AutoCAD assemblies
clr.AddReference('acdbmgd.dll')
clr.AddReference('acmgd.dll')
clr.AddReference('AeccDbMgd.dll')
clr.AddReference('AeccAppMgd.dll')

# Function to get PVI from a specific station range
def get_pvi_in_station_range(alignment_name, start_station, end_station):
    # Get the Autodesk AutoCAD application object
    acad_app = AcadApp.Application.GetApplication()
    
    # Get the Civil 3D application object
    civil_app = CivilApp.CivilApplicationManager.ActiveApplication

    # Get the Civil 3D document
    doc = acad_app.ActiveDocument
    database = doc.Database

    # Get the alignment object by name
    alignment = None
    for align in CivilDb.Alignment.GetAlignmentCollection(database):
        if align.Name == alignment_name:
            alignment = align
            break

    if not alignment:
        raise ValueError(f"Alignment '{alignment_name}' not found.")

    # Get the profile associated with the alignment
    profile = alignment.Profiles[0]  # Assuming the first profile, adjust as necessary

    # Create a collection to store PVIs
    pvi_points = []

    # Iterate through the profile's vertical curve data
    for pvi in profile.PVIs:
        station = pvi.Station

        # Check if the station is within the given range
        if start_station <= station <= end_station:
            pvi_points.append((station, pvi.Elevation))

    return pvi_points

# Input data from Dynamo
alignment_name = IN[0]  # Alignment name from input
start_station = IN[1]   # Start station from input
end_station = IN[2]     # End station from input

# Call the function to get PVIs
pvi_points = get_pvi_in_station_range(alignment_name, start_station, end_station)

# Output the results
OUT = pvi_points