You can achieve this by using a simple loop in a scripting language like Bash or Python. Here's an example in Bash:
```bash
#!/bin/bash
# Your input file
input_file="your_input.txt"
# Output file
output_file="output.txt"
# Counter to track the line number
line_number=0
# Start by creating an empty output file
> "$output_file"
# Read the input file line by line
while IFS= read -r line; do
# Increment the line number
((line_number++))
# Check if it's the last line
if [ $line_number -eq $(wc -l < "$input_file") ]; then
# If it's the last line, enclose in quotes without a comma
echo "\"$line\"" >> "$output_file"
else
# For all other lines, enclose in quotes and add a comma
echo "\"$line\"," >> "$output_file"
fi
done < "$input_file"
```
This script reads each line from the `input_file`, encloses it in double quotes, and adds a comma. For the last line, it encloses it in double quotes without a comma. The output is saved in the `output_file`.
Make sure to replace `"your_input.txt"` with the path to your input file and `"output.txt"` with the desired output file name.