In the problem of infinite square well we come out with quantized energies that an electron can have. And each energy level has its own wave function. The general solution is a linear combination of these wave functions. My question is what is the physical meaning of this quantization, and why the general solution that describes this electron is a combination of the quantized solutions. I'm thinking that when we measure the electron several times, it may be in different energy levels in each measurement. Is this true? And if so, how can it change its energy level?
My question is what is the physical meaning of this quantization...
The physical meaning is that if you were to measure the energy of the electron, you would only measure certain values. You would not get a continuum of energy measurements were you to measure the energy of similarly prepared systems. How often you measure a certain energy value of similarly prepared quantum systems depends on the state of the system before measurement of the energy.
... and why the general solution that describes this electron is a combination of the quantized solutions
Well that just comes from the Schrodinger equation being a linear differential equation. If two equations solve the Schrodinger equation, then any linear combination of these equations also solves it. You can then extend this reasoning to any number solutions. The solutions we can use in this linear combination is determined by initial/boundary conditions of the system in question.
I'm thinking that when we measure the electron several times, it may be in different energy levels in each measurement. Is this true?
You have to be more specific. You have to say what you are measuring. You can't just "measure the electron".
If you mean measure the energy, then what you say is false. For the particle in a box the energy eigenstates correspond to stationary states. So once you measure the electron to be in an energy state, then any subsequent measurement of the energy will yield the same result.
If you mean measurement of the position and then the energy, then you are correct. The position operator and the infinite well Hamiltonian do not commute, so there are not simultaneous eigenstates of both position and energy. This means that when you make a position measurement, the state of the particle becomes a superposition of energy states (and a sharp peak in position space that then evolves according to the SE). Therefore, the outcome of a subsequent measurement of the energy cannot be determined. The probability of an energy measurement will be determined by the superposition of energy states that now describes the state of the electron.
And if so, how can it change its energy level?
Let's say we measured the energy and found the electron to be in the energy state $|n_1\rangle$. Then let's say we measured the position of the electron, and then we measured the energy again and found the electron to be in energy state $|n_2\rangle$. Then it would have "changed energy levels" if $n_1\neq n_2$. Although keep in mind that right after the position measurement but before the second energy measurement the electron is not in any energy state.
This may not be a satisfying response to you, but one way of answering your question is as follows.
Often in physics, our physical expectations about the world lead to mathematical statements. For example, the assumption that fields should vanish at spatial infinity allows us to derive the Euler-Lagrange equation.
The result of quantization works in reverse - the mathematics requires us to rethink our physical intuition that energy can vary continuously. Quantization is the mathematical result of solving the Schrodinger equation subject to boundary conditions, such as those imposed by an infinite square well. Specifically, the boundary condition that the wave function must vanish in regions where $V=\infty$ has the effect of restricting solutions to those that fit an integer number of times into the well, leading to quantization.
The question of general solutions as a combination (a sum, to be precise) of the quantized solutions is also a mathematical result of the Schrodinger equation being a linear differential equation: a sum of solutions to a linear differential equation is itself a solution to the equation. The most general solution to the Schrodinger equation is therefore a weighted sum of all possible solutions, with coefficients yet-to-be determined.