!line: =!removes all spaces from a variable !line!, so you get a,bcd,e.
If you want to remove only one trailing space from the entire row, you can do this as follows:
>>%out% echo !line:~0,-1!
If you want to remove spaces in some columns and leave spaces in other columns, you will have to handle each separately.
For /f "tokens=1-3 delims=," %%A in ('type %in%') do (
set "colA=%%A"
set "colB=%%B"
set "colC=%%C"
>>%out% echo !colA!,!colB!,!colC: =!
)
This, however, will still remove all spaces from the last column.