How can I animate a vertex translation of a triangular mesh?

I have a triangular mesh in my viewport and I used this Python script to move a single vertex of the mesh (Do You know better methods? I am new to Blender and Python).

import bpy

obj = bpy.context.object

edge =[0] #An edge, the first one

vIndex1 = edge.vertices[0] #Get the indices of the vertices of this edge
vIndex2 = edge.vertices[1]

v1 =[vIndex1] #Get the corresponding vertices
v2 =[vIndex2]

vCoord1 = #Get their coordinates
vCoord2 =

edgeVector = vCoord2 - vCoord1 #The vector formed by these two vertices

edgeVector.normalize() #So that it has 1 unit length

distance = 0.5 #Say we want to move v2 of this distance of 0.5 units += edgeVector * distance #Translate the vertex

My doubt is: how can I create the animation of this translation using scripts? This is the code to create a triangular mesh:

# Create a triangle mesh
import bpy

# Initialize our vertices

# Add face

# Create mesh and related object"Triangle")"Triangle",my_mesh)

# Set object location in 3D space
my_obj.location = bpy.context.scene.cursor.location 

# make collection
new_collection ='new_collection')

# Link object to the scene collection

# Create object using blender function