List index out of range while creating 2D Matrix