to buy a car in Germany you shall have residence permit & local driving license.
to bring it into Pakistan, is altogether different process for NICOP / Dual citizenship holders.
a foreigner visitor can not buy a vehicle as title owner. Visitors can rent a car and drive under international driving permit with insurance conditions applied.
end of story