Your problem wasn't only the coding, but also the logic behind it.
Take a look at the code below; I have inserted some comments to show what's being done.
@echo off
setlocal enabledelayedexpansion
set "file=file.txt"
REM read every line...
set line=0
for /f "usebackq delims=" %%A in ("%file%") do (
set /a lines+=1
REM ... and tokenize it...
set count=0
for %%B in (%%A) do (
REM ... into an array.
set /a count+=1
set "Dta[!lines!-!count!]=%%B"
)
)
REM lines now holds the number of lines in the file, count is the number of tokens.
rem set Dta[
REM uncomment above line for troubleshooting (showing the array)
REM for every line [skip first line=Header]
for /l %%l in (2,1,%lines%) do (
REM for each token in the line
for /l %%t in (1,1,%count%) do (
REM echo Array[Header-Token] = Array[Line-Token]
echo !Dta[1-%%t]! = !Dta[%%l-%%t]!
)
REM insert delimiter line if it's not the last line:
if %%l lss %lines% echo -----------
)
See here for a short explanation of delayed expansion. It's easier (and faster) than the call
method, you used.