TE buffer is intended to protect DNA during storage by “buffering” against low pH and EDTA-inhibiting nucleases. DNA samples remained intact and undegraded for longer periods of time when the DNA was dissolved in higher concentrations of EDTA; EDTA added to the buffer inhibits this degradation (Lahiri and Schnabel, 1993). DNA samples that were dissolved in distilled water showed a double band on the gel in the first day, whereas DNAs dissolved in TE buffer did not show a double band. The results of these experiments are shown in Figure 3. It seems that due to the pH of distilled water (pH 5-6) being lower than the pH of the TE buffer (pH 8.0);
TE isn't directly preserving the DNA, but it does protect against certain types of damage.
DNase enzymes have a metal cofactor required for activity. The EDTA will bind to metal ions & inactivate the DNase enzymes. And as Ibrahim Khelifi posted, the buffering ability provides protection against pH damage.
You can still damage DNA stored in TE by high temperatures, sunlight, etc.
TE buffer helps to maintain the pH and protects DNA from nucleophilic attach and lysis. This buffer contains EDTA which is a chelating agent that inactive DNase or RNase and prevents nucleic acid from enzymatic lysis.