In your tests, you used echo to send the value to standard output and thence the pipe, but you left that out in your script. You also need an extra $ to make it a command substitution.
stripped=stripped=$(echo $example | fold -w6 | paste -sd'-' -) will give the desired result.