If you have a list, in text format, such as (example - don't use this - it's pihole's default), named /home/pi/adlists.list
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
https://mirror1.malwaredomains.com/files/justdomains
http://sysctl.org/cameleon/hosts
https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
https://hosts-file.net/ad_servers.txt
create a script file (/home/pi/adlists.sql)
CREATE TEMP TABLE i(txt);
.separator ~
.import /home/pi/adlists.list i
INSERT OR IGNORE INTO adlist (address) SELECT txt FROM i;
DROP TABLE i;
and run
sudo sqlite3 /etc/pihole/gravity.db < /home/pi/adlists.sql
edit
after the correct advise of @DL6ER (thank you for this), changed the sql script to include IGNORE, this to avoid problems with duplicate entries, the database doesn't allow duplicates.
/edit