How to add shell script to jenkins freestyle job
You can specify the script in the "execute shell" step of the build. Where it gets executed will depend on what labels the job needs, and which nodes those labels are associated with.

It sounds like you want to execute this script on an agent. As long as the agent is available, you can request it via a label in the job configuration. It's a bit difficult to determine this without having access to your setup, but if e.g. you have a set of agents on Debian boxes, you could attach the label debian to them, and specify that the job should run on debian nodes in the job configuration. 

If on the other hand it should be run on master (where Jenkins itself is running), you can specify the label master.

You thus need to put your script into the "Execute Shell" box that Jenkins provides you, perhaps declaring what shell and options you want to use:

/bin/bash -xe
du -sh /bbhome/shared/data/repositories/* |sort -h |tail -20 |
while IFS= read -r line;do
        DIR=`echo $line | awk '{print$2}'`
        Rep=`cat $DIR/repository-config |grep 'project\|repo' |  tr '\n' ' '`
        Size=`echo $line | awk '{print $1}' `
        echo $Size $Rep
done



  I need also to add an ssh command to the environment. This should be executed using passwordless authentication.


For this to happen, you need ssh keys to be exchanged with the host onto which you want to ssh into.