How do you reference a scene property by name?
getattr(obj, prop, default)

A custom bpy.props.prop property only has an ID property obj["prop"] once the value is assigned obj.prop = value.  If it hasn't been assigned it returns the default value set when defining the property.   

value = getattr(obj, "prop", None) is the equivalent of value = obj.prop if "prop" is an attribute of obj, None otherwise.

import bpy
context = bpy.context
scene = context.scene
for n in range(1, max_number):
    test = getattr(scene.test_vars, "line_%d" % n, None)