More than £4m is being invested in the railway line between Dunblane and Bridge of Allan at the beginning of next year.