Gitlab CI fails, but gitlab-runner works fine

Replace this template with your information

Hello,

I’m trying to automate the building of a flatpak package. Herefore I am cloning the manifest from github and then edit it. I tried it in the gitlab-runner and there it works as expected, but on a merge request I get the following error message:
sed: -e expression #1, char 86: unknown option to s’`

flatpak_x86_64:
  stage: flatpak
  image: murmele/udplogger:kde_5.12
  variables:
    UDPLogger_ID: com.gitlab.Murmele.UDPLogger
  script:
    - git clone https://github.com/flathub/$UDPLogger_ID.git
    - cd $UDPLogger_ID
    - |
      # Use correct git tag
      if [ -n "$CI_COMMIT_TAG" ]; then
        sed -i 's@\&git_tag .*$@\&git_tag "$CI_COMMIT_REF_NAME"@' $UDPLogger_ID.yaml
      else
        sed -i 's@\&git_tag v[1-9]*.[0-9]*.[0-9]*@\&git_tag "$CI_COMMIT_SHA"@' $UDPLogger_ID.yaml
      fi

      # Replace source url
      sed -i "s@\&git_url .*UDPLogger.git@\&git_url $CI_REPOSITORY_URL@" $UDPLogger_ID.yaml

      # Replace desktop file name suffix
      if [ -z "$CI_COMMIT_TAG" ]; then
          sed -i 's@desktop-file-name-suffix: ""@desktop-file-name-suffix: " (Development)"@' $UDPLogger_ID.yaml
      fi

    # Show Flatpak manifest
    - cat $UDPLogger_ID.yaml

    - flatpak-builder --repo=UDPLoggerRepo build $UDPLogger_ID.yaml
    - flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo --arch=x86_64 UDPLoggerRepo UDPLogger.flatpak $UDPLogger_ID
  artifacts:
    paths:
      - flathub/UDPLogger.flatpak

I replaced the @ with a pipe | and then it worked fine. But why it is different on the gitlab-runner and in the gitlab CI online?