Why does this RL circuit gives out wrong results when a square wave generator is applied across it?
What you're seeing are the initial trajectories of exponential waveforms. If you reduce the square wave frequency, you'll get a better picture of what's happening. With the present frequency, the responses do look like triangular waves, but if you look closely you'll see they are in fact curves, not lines.

The time constant of the circuit is \$\frac{1}{LR}= 2.8ms\$, so try square wave frequencies of, say, 1Hz and 10Hz.