Blender: Scale a group of vertices using python
I prefer a more low level solution. This particular approach requires the object to be in Object Mode, but a small change using Bmesh would let you do it in edit mode. This will give you some insight I hope.



import bpy
from mathutils import Vector

# replace this with reference to your object.
obj = bpy.data.objects['BezierCurve']

def get_average(vert_range):
    med = Vector()
    for vert in vert_range:
        vec = vert.co
        med = med + vec
    return med / len(vert_range)

verts = obj.data.vertices
num_verts = len(verts)
scale = 1 / (num_verts / 4)
j = 0
for i in range(0, num_verts, 4):
    mid = get_average(verts[i:i+4])
    for k in range(i, i+4):
        verts[k].co = verts[k].co.lerp(mid, 1-(j*scale))
    j += 1




For every 4 verts, it finds their average, and scales those verts towards that average by an increasing value every 4 verts. I may have reversed the direction so instead of 1-(j*scale) you might want (j*scale)



for completeness A Bmesh solution, this works in edit mode

import bpy
import bmesh
from mathutils import Vector

def get_average(vert_range):
    med = Vector()
    for vert in vert_range:
        vec = vert.co
        med = med + vec
    return med / len(vert_range)

# Get the active mesh
obj = bpy.context.edit_object
me = obj.data

# Get a BMesh representation
bm = bmesh.from_edit_mesh(me)

verts = bm.verts
num_verts = len(verts)
scale = 1 / (num_verts / 4)
j = 0
for i in range(0, num_verts, 4):
    mid = get_average(verts[i:i+4])
    for k in range(i, i+4):
        verts[k].co = verts[k].co.lerp(mid, 1-(j*scale))
    j += 1

bmesh.update_edit_mesh(me, True)


As you can see you were going in the right direction.