The value of X is calculated only once, as Edgar's last ability resolves.

Artwork
Loading artwork…
Edgar, Master Machinist
Final Fantasy Commander · #80 · EN
Nonfoil—Foil—
Card rules
Once during each of your turns, you may cast an artifact spell from your graveyard. If you cast a spell this way, that artifact enters tapped.
Tools — Whenever Edgar attacks, it gets +X/+0 until end of turn, where X is the greatest mana value among artifacts you control.
2/4
Rare · Illustrated by Immanuela Crovius
Format legality
Commander Legal
Duel Legal
Legacy Legal
Oathbreaker Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Modern Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
Pioneer Not Legal
PreDH Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Tlr Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
Edgar must be under your control in order to start casting an artifact spell using its first ability, but it doesn't need to stay under your control throughout that process or be under your control as the spell resolves. If, for example, you sacrifice Edgar to pay an additional cost of the spell or Edgar is destroyed in response, the spell will still resolve normally.
You must still pay all costs and follow any timing restrictions and permissions for artifact spells you cast from your graveyard this way. Normally, you'll be able to cast them only during your main phase while the stack is empty.
If an artifact you control has X in its mana cost, X is 0 for the purpose of calculating its mana value.