Adding a swap file after installation

I would like to do an Endeavor installation on a PC with a 128GB SSD + a 1Tb HDD with the BTRFS file system.
My intention is to leave the / partition on the SSD and the / home on the HD, but if I use the Calamares installer and choose manual partitioning, I can’t add the swap file, so I have to add it at the end of the installation. I have followed the instructions but I don’t know how to add the volume @swap. I also used the instructions that appear, but I am not able to get it.
When the installation finished I ran in the terminal
sudo btrfs subvolume create / @ swap

sudo mkdir / @ / swap
sudo sh -c “echo ‘uuid / swap btrfs subvol = @ swap, defaults, compress = no 0 0 \ n’ >> / @ / etc / fstab”

sudo truncate -s 0 / @ swap / swapfile
sudo chattr + C / @ swap / swapfile
sudo btrfs property set / @ swap / swapfile compression none
sudo fallocate -l 2G / @ swap / swapfile
sudo chmod 600 / @ swap / swapfile
sudo mkswap / @ swap / swapfile
sudo swapon / @ swap / swapfile
sudo sh -c “echo ‘/ swap / swapfile none swap defaults 0 0’ >> / etc / fstab”

Can someone help me with the creation of the subvolume in BTRFS, I always used EXT4 and I don’t quite understand the concept of subvolume

You have to remove all those extra spaces in your commands. It looks like you have an extra space after each /.

If that isn’t it, you have to share the output of the commands so we can see where the process is failing.