You can find a guide on how to run SPP-loopback.py in How to run SPP-loopback.py on Edison. Regarding how to copy the SPPloopback.py file to your board's file system, it's quite simple, follow these next steps:
1. Copy the whole content of SPP-loopback.py.
2. On your board's terminal enter the command: "vi SPP-loopback.py"
3. The vi environment will then appear, hit the "i" key to enter in edit mode.
4. Paste the content of SPP-loopback.py in vi (right button on your mouse when using PuTTY on Windows, from the terminal's settings when using screen on Linux)
5. Hit the escape button to exit the edit mode on vi and enter ": x".
Now the SPP-loopback.py script is stored on your board, you can now follow the guide I linked above.
Nevertheless, if you are using a BLE device, I suggest you to use GattTool instead of SPP. In Is there a serial port profile for BLE? you will find a very interesting reason why you should use it. You can install GattTool by following steps:
1. wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.24.tar.xz --no-check-certificate
2. tar -xvf bluez-5.24.tar.xz
3. cd bluez-5.24
4. ./configure --disable-systemd --disable-udev
6. make install
You can learn about the functionalities of GattTool with BLE devices in:
If you really want to use SPP, this will get you there.
1. Use your favorite text editor to edit the file /etc/systemd/system/bluetooth.target.wants/bluetooth.service
2. Find the line that reads:
3. Add -C to the end of it, so it reads:
4. Save the file
5. Reboot the edison
6. If you have not paried your BT device with the Edison, do so now.
7. Set the Edison for BT SPP:
~# rfkill unblock bluetooth
~# sdptool add --channel=1 SP
~# rfcomm listen 0 1 2>&1 &
Depending on how you have your Edison setup, you'll need to execute the 3 commands in step 7 every time the Edison boots up.