for LINE in {1..50}; do
for FILE in {1..1000}; do
sed -n "${LINE}p" "${FILE}.dat" >>"~/Escritorio/${LINE}.dat"
done
done
In your script you are using single quotes for the sed expression, variables don't expand inside single quotes, you need to use double quotes.
Also there is a one liner with awk that can do the same:
awk 'FNR<=50 {filename=sprintf("results/%d.dat", FNR); print >> filename; close(filename)}' *.dat
Just create the results directory, or change it in the command to another one, `~` does not expand to home there.